0

I'm struggling to understand why this ajax callback function breaks in IE9 (it works for any other browsers, including IE10+).

What happens in IE9 is that the function does not return anything back from the server. It dies silently. BUT: if i change the datatype to "script", then it works (but I would need to change my serverside script to avoid json, which I do not want).

NB1: I also tried 'jsonp' but that did not solve the problem. NB2: the script uses the jquery form plugin by Mike Alsup.

Here is the function:

    // USER PROFILE
    $('#user-personal-info').ajaxForm(
    {

        dataType: 'json', /* fails in IE9! ok if "script" */
        type: 'POST', 
        beforeSubmit: function(formData, $form, options)
        {
            console.log("before "); // This appears in the console
        },

        success: function(data, statusText, xhr, $form)
        {
            console.log("success"); // this does NOT appear in the console
        }
    });
pixeline
  • 17,669
  • 12
  • 84
  • 109

2 Answers2

0

IE9 doesn't accept console.logs, only in compatibility mode. Took me long to find that out :D

For further explanations look here: Why does JavaScript only work after opening developer tools in IE once?

Community
  • 1
  • 1
user2718671
  • 2,866
  • 9
  • 49
  • 86
0

Turns out it has nothing to do with that: the problem is that IE9 does not send the name attribute value of a BUTTON html element along with the form. I was using the button value on my serverside code, so the relevant, code never 'outputted'. Old IE9- bug, never fixed...

pixeline
  • 17,669
  • 12
  • 84
  • 109