$.getJSON is return a file with IE and Opera browsers

$.getJSON are returning a file with IE and Opera browsers (Firefox, Chrome... works fine).

The code is this:

    tagmode: "any",
    format: "json"
function(data) {
    var ind = 0;
    $.each(data, function(i, pos_reg){
       alert("Recovery " + i++ + " row");
.error(function() {       
    alert("Was an error");

I think the problem is the Http header returned from the server. If I paste the URL on Firefox or Chrome, I see the JSON respond. If I paste the URL on IE and Opera, they tries download the JSON respond as file.

I tried someting like this:

$.ajaxSetup({ scriptCharset: "utf-8" , contentType: "application/json; charset=utf-8"});

But same result :(

Any idea please? Thanks in advance!


This is not the answer to the question. The real question (the original question is vague) is how to make crossdomain ajax call in Opera and Internet Explorer.

Duplicate to Cross-origin Ajax requests don't work in Opera and IE9? as linked by the topic starter.

I know that Opera doesn't open JSON by default, it indeed tries to download the file. You can change this in the settings: "Settings" > "Advanced" > "Downloads", now search for json, if you don't find it, you can create a new type. Now fill in application/json and set it to open with Opera (I added also text/json because sometimes websites return this content-type). Here is a screen capture of those screens:

I guess that you can do something similar in Internet Explorer as well. EDIT: I found the solution for Internet Explorer. It has been answered before on SO, so I will just post here the link to the answer: https://stackoverflow.com/a/2492211 .

Need Your Help

what's the best practice to config Hibernate-Spring for multiple database relationship?

mysql database hibernate spring orm

We have a main mysql database which all of the applications within our organization need the data within this database. How can I config my java web application to use this database with it's speci...

Designing Akka Supervisor Hierarchy

java akka actor supervisor fault-tolerance

Please note: I am a Java developer with no working knowledge of Scala (sadly). I would ask that any code examples provided in the answer would be using Akka's Java API.