Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

The code below works beautifully outside of WordPress but as soon as I attempt to execute it inside of WordPress nothing happens:

var js = jQuery.noConflict();
js(document).ready(function(){
    js('#ClientID').live('change', function() {
        js.ajax({
            url     : 'includes/form.php',
            type    : 'POST',
            dataType: 'json',
            data    : js('#myform').serialize(),
            success: function( data ) {
                   for(var id in data) {        
                        js(id).val( data[id] );                    
                   }
                 }
        });
    });
});

I have triple checked everything, I've put an alert just above js.ajax and it executes, however if it's inside of the js.ajax({ it doesnt do anything. I'm at a loss at why this isn't working.

share|improve this question
    
Have you considered using Admin Ajax instead? –  Rutwick Gangurde Mar 26 '12 at 4:27
    
Have you debugged this in a browser console? I'm wondering if any data is being POSTed by jQuery ... –  EAMann Mar 26 '12 at 15:58
    
You are probably posting to the wrong URL. Check your console, you will probably get 404 response from the server. I suggest you rewrite your functions based on the articles suggested by others. –  Mateusz Hajdziony Jan 6 '13 at 17:52
add comment

1 Answer

First of all I would recommend you to look through AJAX in Plugins article. If it doesn't help, take in consideration these articles as well:

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.