real_illusions Posted November 8, 2009 Share Posted November 8, 2009 Hi all,I'm looking for a way to go about this trick using jquery and ajaxI have a form with a few boxes, for example:box1 = 1, box2 = 2, box3 = 3 etc etc... Where box1 is the name, and 1 is the value. The checkboxes will always be a numerical value.Now, whenever someone checks the box, i would like a message below them to update the total without a page refresh. So, if boxes 1 and 3 were ticked, it would say 4, if boxes 1, 3 and 7 were checked, then the total 11, etc etc. There would be decimals involved, like 1.5 and 3.5 for example, if thats going to cause any trouble.How would I go about this using ajax and preferably jquery if possible??Any help would be appreciated Link to comment Share on other sites More sharing options...
jeffman Posted November 8, 2009 Share Posted November 8, 2009 I don't understand the task. So far it sounds like simple arithmetic you'd do in JavaScript. I'm there's more, I'm not seeing it yet. Link to comment Share on other sites More sharing options...
real_illusions Posted November 10, 2009 Author Share Posted November 10, 2009 Kinda like maths, but i need ajax functionality in it so as not to refresh the page each time an box gets checked, it needs update that one element (like a div) on the page which contains the total number.Does that help? Link to comment Share on other sites More sharing options...
justsomeguy Posted November 10, 2009 Share Posted November 10, 2009 Why does it need ajax though? These are calculations you can do in Javascript without sending anything to the server, so why do you want to send it to the server to do the calculations? Why not just do the calculations in Javascript without sending anything to the server? Link to comment Share on other sites More sharing options...
thescientist Posted November 10, 2009 Share Posted November 10, 2009 I think he's under the impression that changing text in a div requires a refresh of the page, hence why he might think that AJAX would solve that problem? (of displaying the summed value of his checkbox values in a div without refreshing the page).You can just make a function which will do this for you, with only javascript. try googling "change text in div" Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.