easyui form success返回的json数据被更改


我的代码是这样的:
function EditData(){
        //$.messager.progress();    // display the progress bar
        $('#ff2').form('submit', {
            type: "Put",
            contentType: "text/html",
            dataType: "text/html",
            accept: "text/plain; charset=utf-8",
            onSubmit: function () {
                var isValid = $(this).form('validate');
                if (!isValid) {
                    $.messager.progress('close');   // hide progress bar while the form is invalid
                }
                return isValid; // return false will stop the form submission
            },
            success: function (data) {
                alert(data);
                //data = $.parseJSON(data);
                if (data.state == "success") {
                    $.messager.alert('Success', 'Success');
                    CloseWindow('w2');
                } else {
                    $.messager.alert('Failed', 'Failed');
                }
                $.messager.progress('close');   // hide progress bar while submit successfully
            }
        });
        //$('#ff2').submit();
    }

通过Firefox,返回的数据是:

{"state":"success","message":"1","sql":"**"}

但是,当我这样使用时:

alert(data.state);

Firefox弹出如下:

<div id="json">{<ul class="obj collapsible"><li><span class="prop"><span class="q">"</span>state<span class="q">"</span></span>: <span class="string">"success"</span>,</li><li><span class="prop"><span class="q">"</span>message<span class="q">"</span></span>: <span class="string">"1"</span>,</li><li><span class="prop"><span class="q">"</span>sql<span class="q">"</span></span>: <span class="string">"**"</span></li></ul>}</div>

有人能帮我吗?

可以禁用firefox的jsonview。

返回的数据如下:

   data=eval("("+data+")");

最新更新