ajax回调函数 返回404

来源:互联网 发布:交换机更换网络 编辑:程序博客网 时间:2024/04/30 04:04

先贴代码:

JS代码如下。

PProductComposing.searchUp = function() {var _id = "#pProductComposing_type";var url = $('#ctx').val()+"/pages/pProductComposing/form/onChange?productId=" + $("#productId").val()+"&type=" + $("#pProductComposing_type").val();$.ajax( {type : "POST",async : false,"dataType" : 'json',        "url": url,        "success": function(response) {        alert(111);            if (response.isSuccess == "true") {            alert(response.id);            } else {                openErrorAlertModalInFrame(response.msg);            }        },        "error": function(response) {        alert(JSON.stringify(response));            alert("请正确选择类型。");            PProductComposing.disableAllButton();        }    } );};

通过ajax请求到controller中执行方法,方法执行完成后,直接跳到error  的回调函数中。

controller中的方法并没有其他问题。

百度ajax如何判断是success 还是 error  ,是通过返回值,是否是JSON类型来判断的。


解决办法,在后台controller方法上加注解。

@responsebody



0 0
原创粉丝点击