2

undefined发出 ajax 请求时,IE 9 返回而不是数据存在问题。它适用于 Firefox、Chrome、Opera。我试图在 get.php 中设置一些标题。但这没有帮助。

我的代码如下:

<head>
    <script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
    <script type="text/javascript">
       $(document).ready(function(){
           $.ajax({
               type : "GET",
                url : "get.php",
               data : "id=1234&lang=en",
           dataType : 'html', 
            success : function( msg ) {
                         alert( "Data Saved: " + msg);
                     }
           });
       });
    </script>
</head>
4

1 回答 1

2

Returning the MIMEType of application/json; charset=utf8 caused this same behavior for me in IE8. Changing it to application/json; made IE8 magically start functioning. Check what your server is returning for a MIMEType and see if fiddling with that is causing an issue.

Edit: Actually what was causing the real problem is that it should be charset=utf-8 and not as shown above without the hyphen.

于 2013-07-12T16:39:07.663 回答