Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4607012
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T00:38:38+00:00 2026-05-22T00:38:38+00:00

I have an HTML page with a JavaScript code that sends AJAX request. The

  • 0

I have an HTML page with a JavaScript code that sends AJAX request. The request is being handled by my servlet. I’ve thought that it’s “better” and “more correct” to return the data as “application/json” MIME type from the servlet (response content type). However, it drives MSIE crazy – meaning the browser seems not to be capable to display/process this MIME type (Chrome/FF are just fine). When I specify no type explicitly – it works fine in all browsers. Is it real that no MIME type should be returned from servlet for AJAX requests?

Update: my server side is implemented in Java and the MIME type is being defined by a following line:

response.setContentType("application/json");

the response is the following text (only an example):

{ "status" : "DONE", "progress" : 100, "url" : "/7909118672283641787.docx" , "totalBytes" : 17696 } 

Update2: the snippet made of my client-side code (plain javascript, no libraries)

function display_progress(http) {
    if (http.readyState == 4) {
        var again = false;

        if (http.status != 200) {
            document.getElementById('progress_bar').innerHTML = "Wrong response status received: " + http.status + "! Fix the server-side code.";
        } else {
            try {
                var resp = eval('(' + http.responseText + ')');             
                var status = resp['status'];

                if (status == 'DOING') {
                    document.getElementById('progress_bar').innerHTML = "Uploaded: " + resp['progress'] + "%";
                    again = true;
                } else if (status == 'DONE'){
                    document.getElementById('progress_bar').innerHTML = 
                        "Uploaded 100% (" + resp['totalBytes'] + " bytes)! Your file is <a href=\"" + resp['url'] + "\"/>" + "here" + "</a>";
                } else if (status == 'ERROR') {
                    document.getElementById('progress_bar').innerHTML = "Error while uploading!";
                } else {
                    document.getElementById('progress_bar').innerHTML = "Unexpected state: " + status + "! Fix the server-side code.";
                }
            } catch (ex) {
                document.getElementById('progress_bar').innerHTML = "Wrong response received: " + resp + "! Fix the server-side code.";
            }
        }

        if (again) {
            setTimeout("update_progress()", 500);
        }
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T00:38:39+00:00Added an answer on May 22, 2026 at 12:38 am

    As explained here: http://www.entwicklungsgedanken.de/2008/06/06/problems-with-internet-explorer-and-applicationjson/ text/javascript is the correct workaround.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web page that thats sends an Ajax request with a javascript
I have a HTML page that scrolls up and down (not a lot, but
I have a form on an HTML page with multiple submit buttons that perform
I have a page that makes the same JSONP request multiple times in a
I have an HTML page (say welcome.html) which contains an iframe to a page
I have a HTML page with which I want to do some client side
We have an HTML page which displays a bunch of pretty bars using divs
Suppose I have one html page with frames. The left frame is simply a
Setup: I have an HTML page with a fieldset element. The background color of
I'd like to have an HTML page which displays a single PNG or JPEG

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.