如何使用Ajax在Spring MVC中重定向编辑表单?

时间:2017-11-02 06:51:53

标签: jquery ajax spring spring-mvc spring-boot

在视图中,当我点击编辑按钮时我们有编辑按钮我需要使用数据库中的数据编辑页面,但我无法重定向到编辑页面本身

视图中的Ajax表单:

'click .edit': function (e, value, row, index) {
                var val=JSON.stringify(row);
                alert('You click like action, row: ' +val);             
                jQuery.ajax({ 
                    type: "POST", 
                    url: "EditShop", 
                    dataType:"json", 
                    data:JSON.stringify(row) ,

                    processData:false,
                    success : function(data) {
                        console.log("SUCCESS: ", data);
                        display(data);
                        alert('sucess');
                    }, 
                    error : function(e) {
                        console.log("ERROR: ", e);
                        display(e);
                    },
                    done : function(e) {
                        console.log("DONE");
                    }
                }); 

            },

Spring Controller

@RequestMapping(value = "/EditShop" , method = RequestMethod.POST)
      public @ResponseBody shopModel editShop(@RequestBody shopModel shop) {

          System.out.println("Inside Edit Shop : "+shop.getStoreName());

          return shop;
      }

0 个答案:

没有答案