Goal:to display a table populated with data from a json file. within the same function displayData, i want to parse the json file but outside the ajax call. I hope that it does make sense!
i set up an ajax call (which is working):
function displayData(term){
var frmStr =$('#input1').serialize();
$.ajax({
url:'./cgi_tableData.cgi',
dataType:'json',
data: frmStr,
success: function(data, textStatus, jqXHR){
alert("success"),
//how to send the data outside this ajax call within the same function
},
error: function(jqXHR, textStatus, errorThrown){
alert("Failed to perform gene search! textStatus: (" + textStatus +
") and errorThrown: (" + errorThrown + ")");
}
});
............
the question is how do I extract the json file from the ajax call so i can parse the file. I realize that it has to be initiated in success but i can't figure it out? once the data is extracted i will rearrange them in arrays to fit the table constructor.