KitCarl Posted July 11, 2010 Share Posted July 11, 2010 A open source php software package I use has a boolean variable set in the config file that depending on its setting calls a block of code to be used on all pages. I would like to use a check box so the user will be able to toggle the function on and off for the current page by resetting the variable and reloading the page upon the onclick event. Can someone please explain how to go about this using javascript. Quote Link to comment Share on other sites More sharing options...
haku Posted July 11, 2010 Share Posted July 11, 2010 You need to use AJAX, and set an onclick listener to the checkbox. Then when the box is checked, you ping a URL on your server with your javascript. This script should be set to change the value of the boolean depending on whether the user just checked the box, or unchecked it. Quote Link to comment Share on other sites More sharing options...
KitCarl Posted July 11, 2010 Author Share Posted July 11, 2010 This will be my first attempt at adding AJAX/javascript, any chance I could get a code example that will lead me in the right direction? Quote Link to comment Share on other sites More sharing options...
haku Posted July 11, 2010 Share Posted July 11, 2010 Lots and lots and lots of tutorials out there. Google 'Ajax tutorials'. Figure out how AJAX works, after that follow the directions I gave you in the first post. It's really quite an easy usage of AJAX - there is no data returned or anything. Quote Link to comment 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.