Jquery ajax向后台提交json不成功一直执行error
$("#dialog").dialog({resizable:false,height:140,modal:true,autoOpen:false,buttons:{"账...
$( "#dialog" ).dialog({
resizable: false,
height:140,
modal: true,
autoOpen: false,
buttons: {
"账单确认": function() {
var jsonStr = [{'name':'jim' , 'age':20} , {'name':'king' , 'age':26},{'name':'jge' , 'age':30}];
$.ajax({
url:"${path}/billconfirm.action",
type:'post',
data: {'mydata':jsonStr},
dataType:"json",
success:function(data){
$("#dialog").dialog("close");
alert("成功啦");
},
error:function(){
$("#dialog").dialog("close");
alert("出错了哦");
}
});
},
"账单取消": function() {
$( this ).dialog( "close" );
}
},
show: {
effect: "blind",
duration: 1000
},
hide: {
effect: "explode",
duration: 1000
}
}); 展开
resizable: false,
height:140,
modal: true,
autoOpen: false,
buttons: {
"账单确认": function() {
var jsonStr = [{'name':'jim' , 'age':20} , {'name':'king' , 'age':26},{'name':'jge' , 'age':30}];
$.ajax({
url:"${path}/billconfirm.action",
type:'post',
data: {'mydata':jsonStr},
dataType:"json",
success:function(data){
$("#dialog").dialog("close");
alert("成功啦");
},
error:function(){
$("#dialog").dialog("close");
alert("出错了哦");
}
});
},
"账单取消": function() {
$( this ).dialog( "close" );
}
},
show: {
effect: "blind",
duration: 1000
},
hide: {
effect: "explode",
duration: 1000
}
}); 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询