ajax请求出现parse error

原创
2015/04/19 18:17
阅读数 267
var d={
		"userId":1,
		"orderNumber":"number",
		"totalPrice":15.5
};
$("#createOrder").click(function(){
   	 $.ajax({
   	    	url:"Order/createOrder.action",
   	    	type:"get",
   	    	data:d,
   	    	dataType:"json",
   	    	success:function(data,textStatus,jq){
   	                alert(data);
   	            },
   	    	error:function(data,textStatus,jq){
   	    		alert(textStatus);
   	    		alert(data);
   	    		alert(jq);
   	    	}
   	    })
   });

请求后页面提示parse error错误

console提示如下错误:

17:30:48,361 ERROR Dispatcher:38 - Could not find action or result

/MISP/Order/createOrder.action?userId=1&orderNumber=number&totalPrice=15.5

  There is no Action mapped for namespace [/Order] and action name [createOrder] associated with context path [/MISP]. - [unknown location]

谷歌了一下parse error,解释说是返回的不是json对象,然后我将ajax里面的dataType属性删除,依旧报同样的错误。重新检查了一遍代码,然后发现原来struts.xml里面的包名重复了,修改后,程序运行正常。

展开阅读全文
加载中
点击引领话题📣 发布并加入讨论🔥
0 评论
0 收藏
0
分享
返回顶部
顶部