jQuery和IE提交,当作ajaxForm不工作工作、jQuery、IE、ajaxForm

由网友(梦境)分享简介:我有一个表格:一个提交按钮:with a submit button:我有一个表格:

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

一个提交按钮:

with a submit button:

<input type="submit" name="submit" value="Поиск" style="" onmouseover="CheckElements();">

提交按钮应该发送AJAX绑定过程:

the submit button should send ajax bind 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;
    });
});

有接受功能:

function onAjaxSuccess (result)

这一切工作正常,在镀铬,FF,歌剧,Safari浏览器,但它不能在Internet Explorer 9中工作(别人没有尝试过)

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

在IE9中,结果变量是空的。 我尝试另一个绑定提交按钮是这样的:

In IE9, the result variable is empty. I tried another bind submit button like this:

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

但结果是一样的FF铬野生动物园歌剧作品,除了IE9。

But the result is the same ff chrome safari opera work, except for IE9 .

请告诉我可能是什么问题。

Please tell me what could be the problem.

推荐答案

问题在于IE9不理解的JSON的在编码CP1251的格式,即使它在响应头明确说明。在UTF-8 JSON响应的翻译解决了这个问题,IE9。

The problem was that IE9 does not understand the format of "JSON" in the encoding cp1251, even though it is clearly stated in the response header. Translation of the JSON response in utf-8 solved the problem with IE9.

阅读全文

相关推荐

最新文章