Skip to content Skip to sidebar Skip to footer

How To Accept String Return From Controller In Ajax Call

I have a jsp page say something like this
Connection not Enabled

Solution 1:

In your success function you'll want to display this newly called data, by changing:

$("#result").html("connection has been enabled successfully");

To:

$("#result").text(data);

Solution 2:

url:contextPath +"/submitAllInfo", this url is not matching with below action

@RequestMapping(value = "/action", method = RequestMethod.POST)

and also you passing data from your ajax request but there is nothing to handle in controller method String insertAllStepDetails() it should be like

  1. String insertAllStepDetails(@ModelAttribute("formData") AnyClass obj) or
  2. String insertAllStepDetails(HttpServletRequest request)

And also remove processData: false, from ajax request


Post a Comment for "How To Accept String Return From Controller In Ajax Call"