Gyan1010 Posted May 11, 2007 Share Posted May 11, 2007 I have some PHP code that builds an array of data then displays the data in a table. I am trying to write code that instantly sorts the columns in the table by clicking on the column header, without reloading the page. To do this I found some code that allows me to run a PHP file by calling a javascript function. So I basically have PHP that echos a string of html that calls a javascript function which instantly runs another PHP file, and inserts any output of that new PHP file it into the html string at a named <span> Anyway my problem is I need access to my array in the original php file while running the 2nd. I don't know how to pass a PHP variable into javascript then pass that variable into the new PHP file that it runs with the http.open function. Link to comment https://forums.phpfreaks.com/topic/50976-need-help-with-variable-passing-between-php-and-ajax/ Share on other sites More sharing options...
per1os Posted May 11, 2007 Share Posted May 11, 2007 If passing an array you may need to serialize www.php.net/serialize it. But using ajax to pass variables you use get and post. I will not post relevant code as that is more of a javascript side part and to access it by php is simply by $_GET and $_POST. I would do some searching for ajax connection functions or framework or look for an AJAX forum. Link to comment https://forums.phpfreaks.com/topic/50976-need-help-with-variable-passing-between-php-and-ajax/#findComment-250794 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.