简体   繁体   中英

jQuery : Cross domain issues

I am using jsonp and everything works perfect cross domain except some functions.. like:

beforeSend:function(){
     errobj.show();
    errobj.html('<b>Loading...<\/b>');
  },

it never shows loading if i am using it cross domain (subdomains).. also some animations and show and hide things never work.

Anyone has any idea about cross domain ajax/jquery issues?

For security reasons, browsers tend to unilaterally block any calls being made to URLs outside the domain that served the current page. Use JSONP , which can request content cross-domain is the <script> tag. Check these links too
Methods for Handling Cross-Domain Ajax Calls
JQuery ajax cross domain

[EDIT]

Also there is an issue with beforesend() in $(ajax) for datatype jsonp . Cross-domain JSONP requests do not use XMLHTTPRequest, so the event flow is different. beforesend() not firing in JSONP

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM