IE不显示数据库的ajax调用结果

时间:2022-10-25 22:45:55

question says it all... code:

问题说这一切......代码:

$(document).ready(function() {
                dataToLoad = 'showresults=true';
                $.ajax({
                    type: 'post',
                    url: 'submit.php',
                    datatype: 'html',
                    data: dataToLoad,
                    async: true,
                    success: function(data){

                        $('#results').html(data);   
                    },

                });
});

1 个解决方案

#1


1  

You should use

你应该用

dataType: 'html'

instead of

代替

datatype: 'html'

and remove the trailing comma at the end (IE<=7 will throw error)

并删除末尾的尾随逗号(IE <= 7将抛出错误)

If the problem persists, add an error callback to see if there's an error

如果问题仍然存在,请添加错误回调以查看是否存在错误

error: function(xhr, status, errorThrown){
   alert("Error:\n" + status);
}

Hope this helps. Cheers

希望这可以帮助。干杯

#1


1  

You should use

你应该用

dataType: 'html'

instead of

代替

datatype: 'html'

and remove the trailing comma at the end (IE<=7 will throw error)

并删除末尾的尾随逗号(IE <= 7将抛出错误)

If the problem persists, add an error callback to see if there's an error

如果问题仍然存在,请添加错误回调以查看是否存在错误

error: function(xhr, status, errorThrown){
   alert("Error:\n" + status);
}

Hope this helps. Cheers

希望这可以帮助。干杯