Is it possible to write a function that can be called up on everytime someone fills a form and submits it so that all work is done in the same page?
updating database using a function
Collapse
X
-
Tags: None
-
hey dorm.....i mean.....
say i have a picture and i want to comment on it....i fill in the comment box and click on the submit button.....i dont want it to refresh the whole page, i want a function to run in the background that will post it to a DB and also refresh the connection so the last post can be seen on the pageComment
-
why is everyone calling me that? it sounds like Dorm the Worm…
what you describe is an AJAX request. but I don’t see why anyone should be disturbed by a form submit triggered page reload. (that’s what I’d expect, despite that it works even if JavaScript is disabled)say i have a picture and i want to comment on it....i fill in the comment box and click on the submit button.....i dont want it to refresh the whole page, i want a function to run in the background that will post it to a DB and also refresh the connection so the last post can be seen on the pageComment
-
lol im sorry for the name, it;s just shorter to write when im rushing......
what you say is true, but its just the case of having to reload everything on the page....didn't want it to do that but it may be the best optionComment
-
-
ok i managed to find a very very good ajax tutorial to do this and I am working with the code now with ease... the tut made it real simple...
but now i have one question? How can I update this ajax code so once it has processed through the php and is successful it displays the submitted text back on the page? I have a feeling this will probably be moved to the ajax section but I have posted here because the part I'm pulling my hair out is including php
Code:1. $.ajax({ 2. type: "POST", 3. url: "bin/process.php", 4. data: dataString, 5. success: function() { 6. //display message back to user here 7. } 8. }); 9. return false;Comment
-
i know how to add a success method that can change from one div layer to another but I can't seem to work out how to get it to include the entry just placed in a DBComment
Comment