ajax crossdomain call
I am new to ajax
I am trying to get data from the url:
http://202.65.151.110:8080/ShreeMobileWeb/priceupdate" + "?d=" + "2%2C"+ "" + "%2C" + "150" +"%2C" + "100" +"%2C" +"N-A" +"%2C" +"N-A";
and my application is also on the same server 202.65.151.110
but I still get error:
Origin http://202.65.151.110 is not allowed 开发者_StackOverflow中文版by Access-Control-Allow-Origin.
You cannot make an AJAX request to a different server (host AND port) as per the same origin policy. The solution is to use script injection or use JSONP
do you use the same port? it is possible that it tries to access to http://202.65.151.110:80, but not http://202.65.151.110:8080 or vice versa.
The origin includes the port as well as the hostname and ip address.
What everyone else said, but have a look at postMessage, which allows you to do cross-domain communication with JavaScript: https://developer.mozilla.org/en/DOM/window.postMessage
The Google Feed API can adapt any regular XML feed into a JSONP feed.
http://code.google.com/apis/feed/v1/
You could use a proxy -> http://devtreats.blogspot.com/2011/01/cross-domain-ajax.html
精彩评论