Wednesday, 15 June 2011

php - Pass value from one page to another using jQuery -


I have a simple script setup that can be used in jQuery using values ​​from one value to another Is stored. When the link is clicked, the value of the array should be sent to the community.php page, but it is not working and I am not sure how to draw any advice on the community page?

JQUERY

  $ ("# subscribe_link"). Click (function () {$ .post ("community.php", {'options []': ["John", "Susan"]})});   

PHP

  print_r ($ option);  

In fact, you can send an array like this. The problem is that you post There is a need to access the data made and make the first variable of any php execution.

  $ ("# subscribe_link"). Click (function () {$ .post ("community.php", {'choices []': ["John", "Susan"]})}}   

comunity .php: $ option = $ _POST ['option']; print_r ($ option);

Unless you have data with the requested data Your AJAX request will not be able to do anything: Therefore, you must have $ .post ():

  $ ('#btn'). Click (function () {$. Post ("community.php", {'choices []': ["Jon", "Susan"]}, function (data) {warning (data);});});    

No comments:

Post a Comment