My code in main.php is like this:
$(document).ready(function(){
$.getJSON('abc.php?valueOne=value1&valueTwo=value2', function(data){
alert(data);
}
});
in abc.php there are text values and numbers as result which I want to display in main.php
The problem is if it is a number then it is shown in the alert alert(data) else if there are text nothing is working.
Am totally confused about this. Any solutions?
Replace
With
there was missing
);
$.getJSON
expects a JSON response, so you should have this kind of PHP code:Then, inside JavaScript: