Stephen Binns
Stephen Binns

Reputation: 765

jQuery Cross domain ajax calls and Internet Explorer

The following code works fine in Firefox but in IE the link is never called, the exception is called with a rather generic [Object Error]

var GoalID = "e13e68a8-ae18-49f1-9d2f-e052a63fac51";
try
{
    $.ajax({
      type: "GET",
      url: "http://www.externallink.co.uk/GoalAccessed.aspx?id=" + GoalID,
      dataType: "script"
    });
}
catch(err){alert(err);}

Is there any way of overcoming this issue?

Upvotes: 1

Views: 3239

Answers (2)

Kartik Sehgal
Kartik Sehgal

Reputation: 143

You can try load(url, [data], [func]).

I was trying to load HTML pages using $.post which didn't work when I stumbled upon load. I tried to do cross domain referencing (XSS) and it worked with one caveat - user gets a security warning "this page is trying to access information that is not under its control. This poses a security risk. do you want to continue?". If the user says yes, it will allow the content to be loaded.

To understand in more detail with some sample code, you can try the following url:

http://sites.google.com/site/spyderhoodcommunity/tech-stuff/jqueryloadurldatafunc

Upvotes: 0

Ish
Ish

Reputation: 29546

Cross domain Ajax calls are not allowed

Solution (not the best one)

Prepare a local file (e.g. localfile.asp) 
which initiates RPC to a remote server

Upvotes: 1

Related Questions