问题说明了一切......代码:
$(document).ready(function() { dataToLoad = 'showresults=true'; $.ajax({ type: 'post', url: 'submit.php', datatype: 'html', data: dataToLoad, async: true, success: function(data){ $('#results').html(data); }, }); });
答案 0 :(得分:1)
你应该使用
dataType: 'html'
而不是
datatype: 'html'
并删除末尾的尾随逗号(IE< = 7将抛出错误)
如果问题仍然存在,请添加错误回调以查看是否存在错误
error: function(xhr, status, errorThrown){
alert("Error:\n" + status);
}
希望这会有所帮助。 干杯