I have a JSON array as shown below :
[{"id":"1","text":" Hi this is text 1","value":"200"},
{"id":"2","text":" Hi This is text 2","value":"300"}]
Now in jQuery file I have a GET request and I am doing something like below but it’s not working.
$.get("get.php",{city:selectedCity},function(data){
if(data) // I have tried even [ data!=0 and data!="" ] .....but will not work
{
alert("data received");
}
else alert(" Not received ");
},"json");
But strangely the things are not working as intended. Please tell me if i am reading the array wrongly.
ALright ! The problem was with variable name which wasn’t send correctly to php file . Problem solved . Thanks for the comments guys