title: Spring MVC send and receive the parameters using ajax
body: <p>I'm sending the request ajax to spring controller. But it not showing anything WHen I send the request.</p>
  
  <p>My ajax request</p>
  
  <pre><code>  $(".secs li a").on("click",function(e){
        e.preventDefault();
        var id = $(this).data("value");
            $.ajax({
                url:"../tmax",
                type:"POST",
                data:{id:id},
                success: function(response){
                    $("#testdata").html(response);
                }
            })
  
        })
  </code></pre>
  
  <p>And my controller</p>
  
  <pre><code>@RequestMapping(value = "/tmax", method = RequestMethod.POST)
  public ModelAndView tmax(@RequestParam("id") String id) {
      ModelAndView model = new ModelAndView("tmax");
      model.addObject("dataCOLL", userService.finddataCOLLById(id));
      return model;
  }   
  </code></pre>
  
  <p>I'm sending the request in the <strong>home.jsp</strong>. The data should get <code>tmax.jsp</code> and show in <strong>home.jsp</strong>.</p>
  
  <p>My tmax.jsp page</p>
  
  <pre><code>&lt;p&gt;Hello World&lt;/p&gt;
  </code></pre>
  
  <p>Thanx</p>