PDA

View Full Version : Problem in implementing ajax



mor_mah
07-03-2010, 06:31 PM
hi.
Two ajax and php files are located in a domain. and, ajax is calling in another domain.
Why get a response from php is empty? While not empty.
Like the image attached.

thanks for your answer.

Spudhead
07-05-2010, 12:50 PM
We'd be able to help you much better if you posted the code you're using.

I'm guessing you're coming up against the same-origin policy (http://www.jimbojw.com/wiki/index.php?title=Introduction_to_Cross-Domain_Ajax).

You can either get the AJAX target page to spit out JSON wrapped in a callback function (JSONP (http://www.myviewstate.net/blog/post/2010/02/26/Make-cross-domain-Ajax-requests-with-jQuery.aspx)) or you can simply fire your cross-domain requests at a proxy PHP script on your own server; the script fetches the target content and returns it to your AJAX call.

HTH.

mor_mah
07-06-2010, 03:26 PM
I realized that xhr.readystate = 4 and xhr.status = 0. What does this mean?

Fumigator
07-06-2010, 05:02 PM
I realized that xhr.readystate = 4 and xhr.status = 0. What does this mean?

Are you using raw Ajax here? If so I think you may get better help if you have your post moved to the Ajax subforum. This is the Javascript Frameworks forum.