nbhatti2001
nbhatti2001

Reputation: 363

ajax call not responding

An ajax call creating problem. It works fine in browser but through ajax it is not going to called. URL is here http://testbed2.baileyprofile.com/dd-api.php?test=1

When I check it in firefox inspect element console. It sends the request and in about 900 miliseconds or mroe then it give message 200 Ok and url color turn to red. It generate no response at all.

Please any hint what problem it may have. My code is as under

 jQuery.post(ajaxurl, {action: 'test' }, function(response) {
        if (response!= '') {
             jQuery('#test-result').html("Restule is generated successfully, copy of result has been sent to your inbox").fadeOut(10000);
             document.getElementById("txtFeedback").value= response;
            //console.log(response.data);
            //alert('POST title: ' + response.data.post_title);
        } else {
            // something didn't go well
            console.log(response.status);
        }
    });

Upvotes: 0

Views: 1396

Answers (2)

gdoron
gdoron

Reputation: 150303

Update:

I have a.com and sending request to b.com. Is it should make any problem?

You're violating the Same origin policy, you can't make an ajax from domain a.com to b.com

Upvotes: 1

JohannesAndersson
JohannesAndersson

Reputation: 4630

Data parameters should be within ''. Try it and it should work

jQuery.post(ajaxurl, {'action': 'test' }, function(response) {
        if (response!= '') {
             jQuery('#test-result').html("Restule is generated successfully, copy of result has been sent to your inbox").fadeOut(10000);
             document.getElementById("txtFeedback").value= response;
            //console.log(response.data);
            //alert('POST title: ' + response.data.post_title);
        } else {
            // something didn't go well
            console.log(response.status);
        }
    });

Upvotes: 0

Related Questions