xerox02 Posted June 21, 2010 Share Posted June 21, 2010 How do you pass a Javascript variable to a PHP variable without reloading the page? (I am pretty sure this is done through ajax) I am trying to make a simple checkbox in js, and depending on the state of the checkbox, I want the value of the current state of the checkbox to be put into a js variable. After that, I want to send that js variable value to a php variable, and then just echo the value. An example file would be amazing! Thanks a lot, Xerox02 Quote Link to comment https://forums.phpfreaks.com/topic/205404-how-to-pass-a-javascript-variable-to-a-php-variable-without-reloading-the-page/ Share on other sites More sharing options...
xerox02 Posted June 21, 2010 Author Share Posted June 21, 2010 It is a 3 state checkbox btw . One state when mouse is not over, another when over and then one when clicked(it keeps the state until clicked again), when clicked again it goes back to first state. Quote Link to comment https://forums.phpfreaks.com/topic/205404-how-to-pass-a-javascript-variable-to-a-php-variable-without-reloading-the-page/#findComment-1074973 Share on other sites More sharing options...
trq Posted June 21, 2010 Share Posted June 21, 2010 There are heaps of simple ajax examples around. I would recommend using a framework though, they make things allot simpler. Check out http://jquery.com Quote Link to comment https://forums.phpfreaks.com/topic/205404-how-to-pass-a-javascript-variable-to-a-php-variable-without-reloading-the-page/#findComment-1074981 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.