...">

Jquery and IE submit, ajaxForm not working

I have a form:

<form method="post" action="/balda/server.wsgi" id="gameboard" name="gameboard" >

with submit button:

<input type="submit" name="submit" value="" style="" onmouseover="CheckElements();">

submit button should send ajax binding process:

jQuery(document).ready(function(){
    jQuery('#gameboard').submit( function() {
        $.ajax({
            url     : $(this).attr('action'),
            type    : $(this).attr('method'),
            dataType: 'json',
            data    : $(this).serialize(),
            success : function( data ) {
                       onAjaxSuccess( data );
                    }
        });
        return false;
    });
});

There is an accepted function:

function onAjaxSuccess (result)

All this works fine in chrome, ff, opera, safari, but it does not work in Internet Explorer 9 (others have not tried)

In IE9, the result variable is empty. I tried another send message button:

$('document').ready(function( result )
{
    $('#gameboard').ajaxForm( {    
        type: "POST",
        data    : $(this).serialize(),
        success: onAjaxSuccess,
        dataType: 'json',
        error: function(){ alert ( 'Error loading data format.' ); }
    }); 
});

But the result is the same as ff chrome safari work, with the exception of IE9.

Please tell me what could be the problem.

+3
source share
2 answers

The problem was that IE9 does not understand the cp1251 encoded "JSON" format, although it is clearly indicated in the response header. Translating the JSON response into utf-8 solved the problem with IE9.

+4

, = "text/javascript" , script , IE js

<script type="text/javascript">
  ....... 
</script>
+2

All Articles