![]() |
jQuery and instant submit
You would think this would be one of the most common things to find a tutorial on, but I'm googling up a storm with absolutely no payoff.
I still haven't gotten around to learning how to do this, and I'm sure the concept would be easy if I did, but on the upside, the books ARE on order. In the meantime, I would like to find a tutorial that shows me how to use jQuery similar to what this forum does with responses and the same as many comment systems, or even twitter for that matter. I want to submit a small 200 character text area and have it show up above the form instantly. No, I'm not trying to create a social media site. Just a simple online task list for myself and I'd like to add the functionality to just spam it with entries and have them show up as I submit them. The PHP is easy, but I can't find a tutorial on how to do the ajax side. |
Wrote this up right quick...might be rife with syntactical errors
This is really just a matter of DOM traversal which is devilishly easy with the Sizzles library ( It's what jQuery uses under the hood to traverse DOM also developed by Resig ) We simply do a post to the script and wait for the response, one we get it back, we format it to our liking and insert this new element AFTER the last post item. jQuery provides an easy method of doing this element:last js Code:
|
Now this may sound silly, and I appreciate the help, but how do you pass data from the php back to the jquery that called it? json_encode and set it to a Javascript variable called response?
|
| All times are GMT. The time now is 12:52 AM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0