send and retrieve key-value pair between php and jquery ajax? -
I use $ .get to run the php file I added key-value to jquery from php-file How can I send (like variables)? And when sent, how can I get them with jquery? I want to validate as if (key == value) in jquery
And what's the difference between $$ .getJSON and $? Can not I use $$ .getJSON if I want to run PHP?
I tried to use the php file:
  echo '{"url": 1}'; I also tried:    $ json ['url'] = 2; Echo json_encode ($ json);  
  and I use the jquery file: 
   warning (data.url);  
  But this did not work, it displayed "undefined". 
  What's wrong 
 
You can use it with PHP. Javascript:
  $ (function () {$ .getJSON ("/ some / script.php", function (data) {warning (data.url);})}};   On the PHP side usage:
    
Comments
Post a Comment