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 8868293
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:14:16+00:00 2026-06-14T17:14:16+00:00

have a problem with JSON not working with Internet Explorer (IE9). I’ve searched the

  • 0

have a problem with JSON not working with Internet Explorer (IE9).
I’ve searched the web alot, and tried the different solutions, but nothing seems to work for me. So thought it was time to create a SO account and ask my first question.

I’m using JSON and jQuery/AJAX to create a simple upload progress indicator
The indicator works fine in Firefox and Chrome

This is my view function:

@never_cache
@admin_required
@render_to("editor/edit_file.html")
def edit_file(request, file_id=None):
    if file_id:
        try:
            file = Document.objects.get(pk=file_id)
            form = DocumentForm(request.POST or None, files=request.FILES or None, instance=file)
        except Document.DoesNotExist:
        form = DocumentForm(request.POST or None, files=request.FILES or None)
    else:
        dir_id = request.GET.get("dir")
        if dir_id:
            try:
                dir = Directory.objects.get(pk=dir_id)
                form = DocumentForm(request.POST or None, files=request.FILES or None, initial ={"directory":dir_id, "available_to":dir.available_to})
            except:
                form = DocumentForm(request.POST or None, files=request.FILES or None)
        else:
            form = DocumentForm(request.POST or None, files=request.FILES or None)

    result = {}
    response = locals()

    if request.method == "POST":
        if form.is_valid():
            file = form.save()
            result["status"] = "ok"
            result["href"] = reverse("portal.editor.views.files_list", args=[file.directory.pk])
            if not request.is_ajax():
                response = HttpResponseRedirect(reverse("portal.editor.views.files_list", args=[file.directory.pk]))
        else:
            result[status] = "error"
        if request.is_ajax():
            response = HttpResponse(json.dumps(result), mimetype="text/plain")
            add_never_cache_headers(response)
    return response

and here is my jQuery code:

if ($("#id_edit_form").length > 0) {
    $("#id_edit_form").ajaxForm({
        type: "POST",
        cache: false,
        dataType: "json",
        beforeSubmit:  function (formData, jqForm, options) {
            $("#id_overlay").height($(document).height()).show();
        },
        success: function (response, status, xhr, $form) {
            $("#id_overlay").hide();
            if (status === "success") {
                if (response.status === "ok") {
                    location.href = response.href;
                } else if (response.status === "error") {
                    for (var item in response.form) {
                        $("#id_" + item).parent("p").next("p.js_form-error").html(response.form[item][0]);
                    }
                } else { alert(response.result); }
            } else { alert("Error status:", status); }
        }
    });
}

I feel like I’ve tried everything. Also tried changing mimetype to “text/plain” and it still didn’t work.
I’m using Django 1.3, Python 2.6 and jQuery 1.6.1 with nginx server.

What about mimetype in nginx/mime.types? Should I add json in this file?
I really need help with this, since I’ve been tearing my head of due to this problem!

Thanks in advance

  • 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-06-14T17:14:17+00:00Added an answer on June 14, 2026 at 5:14 pm

    the syntax error was probably that comma after last }

    success:       function(response, status, xhr, $form){
                $("#id_overlay").hide();
                    if( status == "success" ){
                        if( response.status == "ok"){
                            location.href = response.href;
                        }else
                        if(response.status == "error" ){
                            for(var item in response.form){
                                $("#id_"+item).parent("p").next("p.js_form-error").html(response.form[item][0]);
                            }
                        }else
                            alert(response.result);
                    }else
                        alert("Error status:", status);
            },
    

    THAT last comma. IE is very picky about such stuff.

    I did some reading about ajaxForm that you are using. Is this that : http://malsup.com/jquery/form/ ? Seems to me that you could use it much easyer or forget about it completely and use jquery ajax like this:

    $('a.submit').live('click', function(event){
        event.preventDefault();
        var f = $(this).parents('form');
        data = f.serialize();
        if (contactIsWorking == false){
            $.ajax({
                'type':'POST',
                'url': '/contactform/',
                'data': data,
                'datatype':'json',
                'beforeSend':function(){
                    contactIsWorking = true;
                },
                'success':function(data, textStatus){
                    postHandler(f, data);
                },
                'error':function(jqXHR, textStatus, errorThrown){
    
                },
                'timeout':function(data){
                },
                'complete':function(data){
                    contactIsWorking = false;
                    spinner.fadeOut(500);
                }
            });
        }
    });
    

    Took this code quickly from one of my projects – it probably has too much info but i guess you can filter out whats needed

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

Sidebar

Related Questions

I tried solutions given for this problem. But still, it is not working. I
I have a problem with Json formating returned from .ASMX I need to return
I have a problem using JSON and arrays. Here is my code: while($row =
I have a problem accessing JSON data. I'm new to JSON and jquery so
I have a problem with deserializing JSON data from an external REST service. Depending
I have a problem in binding JSON data to KENDO Pie Chart. I have
i have a problem when try to get and parse a remote JSON. require
I Have two problem in this Case : I want to pass a JSON
I have a little problem with Jquery getJSON function. my json here { entries:
I'm having a problem. I have the list of JSON objects in a separate

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.