MaatDeamon
MaatDeamon

Reputation: 9761

How to support jQuery Ajax Cross domain request with IE7

I need to make some jQuery code compatible with IE7. However, I am making cross domain request. As of now, is there any easy, simple way to do cross domain request with IE7 using jQuery ajax ?

Upvotes: 0

Views: 152

Answers (1)

vizcaine
vizcaine

Reputation: 11

You can... IF you can control how the server sends the response...

Just use dataType='jsonp' in your .ajax() call. jQuery will append a 'callback' parameter to the request and generate a random value for it. On the server side you should wrap the response inside a function call. The name of that function should be the value of the 'callback' parameter.

e.g. ajaxCall -> www.theserver.com?callback=whatever

(get the value of the callback parameter on the server)

server response -> whatever({actual json response});

You can get the value in the .done function of your .ajax call

Upvotes: 1

Related Questions