P4tR
P4tR

Reputation: 114

jQuery ajax request succeeds on firefox, but not on internet explorer

I want to check whether the url shown below is reachable or not. On firefox the request fails when the page isn't up running, but also no error is shown.. On internet explorer always "success" is displayed. How can i solve this, so that IE is also supported? And why are errors not be displayed anyway? Thanks in advance!

var link = "http://localhost:8387/nscalemc/";

$.ajax({
    type: "GET",
    url: link,
    crossDomain: true,
    dataType: "script",
    success: function() {
        alert("success")
    },
    error: function() {
        alert("error");
    }
})

Upvotes: 0

Views: 416

Answers (2)

Silas Hansen
Silas Hansen

Reputation: 1739

Best solution, instead of doing this in $.ajaxSetup
Add

cache: false 

to your $.ajax call.

Another quick fix
Change "GET" to "POST" as POST's are not cached. It depends on your solution if this is a viable workaround.

Upvotes: 0

matino
matino

Reputation: 17715

Ajax GET request are usually cached by IE. You will need to disbale caching manually:

$.ajaxSetup ({
        cache: false
});

Upvotes: 1

Related Questions