代码如下:
$.ajax({
url:'/userManager/edit_ui.do?userId='+userId,
type:'post',
dataType:'html',
success:function(data){
var user=eval("("+data+")");
$("#edit_name").attr("value",user.username);
}
});
原来写的是dataType:'json' 但是在火狐下报SyntaxError: missing ] after element list ,修改为dataType:'html' 后正常
本文详细介绍了在使用jQuery的$.ajax方法进行Ajax请求时,遇到dataType设置为'json'导致SyntaxError的问题,并提供了正确的解决方案,即将dataType改为'html'。此问题常见于前端开发中。
5181

被折叠的 条评论
为什么被折叠?



