user1713941
user1713941

Reputation: 150

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?

Upvotes: 0

Views: 173

Answers (1)

Nandakumar V
Nandakumar V

Reputation: 4625

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

Upvotes: 1

Related Questions