I am attempting to make an ajax call and store the JSON
response in a variable. My goal is to display the JSON response in two separate Jqgrids
, with one displaying half of the response and the other displaying the remaining half. I need some ideas on how to achieve this.
Although this is how I'm trying to store the JSON
response, I'm encountering an undefined error
when passing the variable to the alert()
function.
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);
}
}