Jump to content

Recommended Posts

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.

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.