title: Make an AJAX call in the next page
body: <p>I have a scenario for which is as below:</p>
  
  <p>From the home page, I have a search box in which when the user enter the query and hits the search button, the form is submitted and the new page is opened with the search query as the parameter of that new page, the requirement is such that I have to make an AJAX call in the newly opened page based on that query parameter in the URL but the problem is such that when the new page is opened, it gets refreshed and the data is not returned, I have tried "return false" but that would work only on the same page.</p>
  
  <p>How do I pass the data such that when the new page is opened, it should make an AJAX call.</p>
  
  <p>Below is the code I have written:</p>
  
  <pre><code>$(document).ready(function(){
  
         var queryString = new Array();
  
              if (queryString.length == 0) {
                  if (window.location.search.split('?').length &gt; 1) {
                      var params = window.location.search.split('?')[1].split('&amp;');
                      for (var i = 0; i &lt; params.length; i++) {
                          var key = params[i].split('=')[0];
                          var value = decodeURIComponent(params[i].split('=')[1]);
                          queryString[key] = value;
                                                              }
                                                                      }
                                          }
              if (queryString["q"] != null) {
                  var searchQuery =  "&lt;b&gt;Search Results for:&lt;/b&gt; " + queryString["q"] + "&lt;br&gt;&lt;br&gt;";
                  $("#lblData").html(searchQuery);
              }
  
  
              $('#search-button').click(function(){
  
          var queryValue =  queryString["q"];
  
                $('#search_results').hide();
  
                  $.getJSON( "${kb_endpoint_url}", { search_query : queryValue } )
                  .done(function( data ) {
  
  
                        console.log("success");
  
                        for (var i = 0, len = data.response.docs.length; i &lt; len; i++) {
  
                          var title = data.response.docs[i].title;
                          var summary = data.response.docs[i].sectionid;
  
  
                        $('#search_results').html('&lt;a href="'#'"&gt;'+title +'::'+ summary+'&lt;/a&gt;');    }
                      })
                      .done(function() {
                          console.log("second success"); 
                          })
                      .fail(function() {
                          console.log("error"); 
                      })
                      .always(function() {
                          console.log("finished");
  
                      $('#search_results').show();
  
                      });                   
                          return false;
                  });
  
  
  
  
          });
  </code></pre>