i use $.get to run php file. how can i send key-value pair (eg. variables) from the php-file to jquery? and when sent, how can i retrieve them with jquery? i want to validate eg. if(key == value) in jquery.
and what is the difference between $.getJSON and $.get? if i want to run php i cannot use $.getJSON?
i tried in the php file use:
echo '{"url": 1}';
i also tried:
$json['url'] = 2;
echo json_encode($json);
and in jquery file i use:
alert(data.url);
but it didnt work. it displayed "undefined".
what is wrong