The jquery ajax get call in the function below is supposed to pass some parameters to test.php, have test.php perform some tests based on these parameters, and return the (jason encoded) test result (status_general) to .get(). However, the console.log call in the code below shows a value undefined, while my php debugger shows that test.php returns the proper jason encoded test result. My .get code is based on example 5 of http://api.jquery.com/jQuery.get.
Any suggestions what goes wrong/how to fix it? Thanks in advance for the help.
Code:
$.get( "test.php", { command: "test", val1: ipaddress, val2: "" })
.done(function(data) {
var test_result = data.status_general;
console.log('test result: '+test_result);
},"json");