title: Redirect to another jsp (with response data) after ajax call
body: <p>I am using an ajax call to get some places after the call is successfully executed I want to pass that data to another jsp and show it there. my code is</p>
  
  <p>Ajax Call</p>
  
  <pre><code> $(".savebutton").click(function(){
              $.ajax({        
                  url: "&lt;c:url value='/findPlaces' /&gt;",
                  type: 'POST',            
                  data:{  
                      preferences : preferences
                  },
                  success: function(response) 
                  {
                      console.log(response);
                      window.location.href = "places";;
                  }, 
                  error: function(xhr, ajaxOptions, thrownError) {
                      alert('Error');
                  }
              });
          });
  </code></pre>
  
  <p>Controller Action</p>
  
  <pre><code> @RequestMapping(method = RequestMethod.POST, value = "/findPlaces")
  public ModelAndView findRecommnededPlaces(HttpServletRequest request) {
  
      Map&lt; String, Integer&gt; userPreferences = new HashMap&lt; String, Integer&gt;();
      Map&lt; String, Integer&gt; sortedUserPreferences = new HashMap&lt; String, Integer&gt;();
  
      userPreferences.put("Museum", Integer.parseInt(request.getParameter("preferences[Museum]")));
      userPreferences.put("Night Life", Integer.parseInt(request.getParameter("preferences[Night Life]")));
      userPreferences.put("Food", Integer.parseInt(request.getParameter("preferences[Food]")));
  
      userService.scalePreferences(userPreferences);  
      sortedUserPreferences = userService.sortPreferences(userPreferences);
  
      Map&lt; String, Map&lt; String, Integer &gt;&gt; categorisedPlaces = new HashMap&lt; String, Map&lt; String, Integer &gt;&gt;();
      Map&lt;String , List&lt;String&gt;&gt; recommendedPlaces = new LinkedHashMap&lt;String, List&lt;String&gt;&gt;();
  
      List&lt;Place&gt; places = searchService.search(new Location(SOURCE_LATITUDE,SOURCE_LONGITUDE), new Location(DEST_LATITUDE,DEST_LONGITUDE));      
      categorisedPlaces = placesService.categorize(places);
      recommendedPlaces = placesService.getRecommendedPlaces(sortedUserPreferences, categorisedPlaces);
  
      ModelAndView model = new ModelAndView("places");
      model.addObject("recommendedPlaces", recommendedPlaces);
      return model;
  }
  </code></pre>
  
  <p>places.jsp</p>
  
  <pre><code>&lt;div id="content"&gt;
          &lt;c:forEach var="entry" items="${recommendedPlaces}"&gt;
              Cat:  ${entry.key} &lt;br/&gt;
              Places: ${entry.value}&lt;br&gt;
          &lt;/c:forEach&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p>How I can redirect to places.jsp and passing the recommndedPlaces there , currently in ajax response I am getting the whole html page</p>