Jump to content

Passing javascript variables to PHP


JustinM01

Recommended Posts

OK, I have a PHP calendar function that displays all the posts for the current year (when the page loads). I have arrows that allow the user to change which year to display. I'm trying to use AJAX so the page wouldn't have to be reloaded. I have it setup like this:

 

Calendar page -> Javascript js file -> PHP handling script

 

The handling script creates a new calendar object and initializes it to the requested year. The problem is that the two objects are not referencing the same object, so a user can only decrease the calendar date to 2006 or increase it to 2008 because every time the original page loads the calendar initializes to 2007. I don't have a problem passing variables from the original page through javascript and to the handling php script, but I do in the reverse direction. I currently call the javascript function from an onClick event in a link.

 

Is there something I'm not seeing, or will the way I'm currently doing it not work and is there another way I should look at?  ???

 

Thanks.

Link to comment
https://forums.phpfreaks.com/topic/47182-passing-javascript-variables-to-php/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.