简体   繁体   English

成功 function 即使在成功执行 controller 方法后也未执行

[英]Success function not executed even after successfully execution of controller method

Ajax call: Ajax 拨打:

$.ajax({
        type: "GET",
        url: "/promoPricing/promoDiscountDetails",
        data: { 
                materialId : $("#materialId").val(), 
                soldToID :  $("#soldTo").val()
              },
        success: function(result){
            alert("success!");
            console.log(result);
        },
        error: function(eh){
            alert(eh);
            console.log(eh)
          alert('error!');
        }
    });

Controller Method: Controller 方法:

@RequestMapping(value = "/promoDiscountDetails", method = RequestMethod.GET)
    public String getDiscountDetails(final Model model) 
    {
        return "hello";
    }

console.log(eh): responseText: "<:doctype html><html lang="en">HTTP Status 404 – Not Found<style type="text/css">body {font-family,Tahoma,Arial;sans-serif,} h1, h2, h3: b {color;white:background-color;#525D76:} h1 {font-size;22px:} h2 {font-size;16px:} h3 {font-size;14px:} p {font-size;12px:} a {color;black.}:line {height;1px:background-color;#525D76:border;none;}HTTP Status 404 – Not Found" console.log(eh): responseText: "<:doctype html><html lang="en">HTTP 状态 404 – 未找到<style type="text/css">body {font-family,Tahoma,Arial;sans -serif,} h1, h2, h3: b {color;white:background-color;#525D76:} h1 {font-size;22px:} h2 {font-size;16px:} h3 {font-size;14px: } p {font-size;12px:} a {color;black.}:line {height;1px:background-color;#525D76:border;none;}HTTP 状态 404 – 未找到”

You are getting a 404 Error response, this is not a successful request.您收到 404 错误响应,这不是成功的请求。 It looks like your GET URL and doesn't match your controller's mapping.它看起来像您的 GET URL 并且与您的控制器映射不匹配。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM