views:

982

answers:

2

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?

+1  A: 

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
Ish Kumar
Cross domain XHR requests are not allowed. Dynamically importing scripts on external domains is fine - and that is what the dataType: "script" parameter for jQuery does.
David Dorward
A: 

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

Kartik Sehgal