View Full Version : Submit form by ajax & post method
ranacseruet
Feb 15th 2009, 6:23 am
I want to submit a form in ajax mode & using post method so that i don't need to build the query string. Is there any way to do this?
Thanks
dimitar christoff
Feb 15th 2009, 6:36 am
i posted something like that in my blog last week:
http://fragged.org/getting-fancy-with-ajax-your-first-form-submission-and-verification_460.html
ranacseruet
Feb 15th 2009, 6:56 am
Hi, thanks for the reply...
MMJ
Feb 15th 2009, 11:36 am
i posted something like that in my blog last week:
http://fragged.org/getting-fancy-with-ajax-your-first-form-submission-and-verification_460.html
Might want to read about using ajax in the onsubmit event: http://www.alistapart.com/articles/userproofingajax
Also, a small comment, the "level" of javascript at the sitepoint javascript forum (http://www.sitepoint.com/forums/forumdisplay.php?f=15) is considerably higher then here, some pretty good experts over there.
dimitar christoff
Feb 15th 2009, 11:55 am
Might want to read about using ajax in the onsubmit event: http://www.alistapart.com/articles/userproofingajax
sorry, was this directed at me or? :D
MMJ
Feb 15th 2009, 12:26 pm
sorry, was this directed at me or? :D
Yeah, it just came to mind, a bit random tbh :)
dimitar christoff
Feb 15th 2009, 1:13 pm
oh. just like that... I had a cursory look but since you are not elaborating on the _why_ i may want to be reading it, i failed to discover anything of significance that i did not know already.
(p.s. the context of my post is to help people kickstart their first attempt at getting some form processing and an ajax request working, not user proofing the actual xhttp process.
naturally, the Request class in mootools supports the whole methodology like onProgress, onFailure, timeouts and so forth - i just do not consider these to be of the kind of things one pulls off on a first date, that's all)
(p.p.s, wonder if I will ever be good enough to open a SP account, eek! i have 3 feed readers, you know)
:D
MMJ
Feb 15th 2009, 1:47 pm
Yeah, i thought for some reason that you couldn't use ajax in onsubmit at all but it seems like you can but just cant use ajax and use the onsubmit, you have to use one or the other (which makes sense in a way).
dimitar christoff
Feb 15th 2009, 2:41 pm
well yes, its either one or the other - naturally.
in a semantic setup where your form is submitting to a form processor and works independently of any clientside settings, the ajax layer would come 'on top' of the form's onsubmit method, effectively highjacking it. it needs to intercept the event AND kill it lest the form submits and the url changes in the middle of your field processing. in that sense, yes, once the event's default action is dead, you can do the ajax call at your own leisure.
can't really think of an alternative to the above other than building an ajax call out of elements that are not a part of a form and building a custom trigger event around a submit button--then yes, there won't be a onsubmit but it won't be very accessible etc.
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.