title: Getting Undefined Error when trying to store ajax JSON response into variable
body: <p>I am trying to make ajax call and i want to store the <code>JSON</code> response into variable.<br>
  Because the JSON response, i want to pass it to two <code>Jqgrids</code>. One will display half of the response and another will display remaining response. Please help me with some idea to display on <code>Jqgrids</code>. </p>
  
  <p>This is how i am trying to store <code>JSON</code> response, but i am getting <code>undefined error</code> while passing variable to <code>alert()</code> function.</p>
  
  <pre><code>var form_data;
  $(searchBTN).click(function(event))
  {
      $.getJSON("search?dealId=" + orderId,
          function(json) {
              form_data = json.CompanyName;
              checkdata();                                        
          });
  
      function checkData() {
          console.log(form_data);
          alert(form_data);
      }
  }
  </code></pre>