Submit form by ajax & post method

Discussion in 'JavaScript' started by ranacseruet, Feb 15, 2009.

  1. #1
    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
     
    ranacseruet, Feb 15, 2009 IP
  2. dimitar christoff

    dimitar christoff Active Member

    Messages:
    882
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    90
  3. ranacseruet

    ranacseruet Peon

    Messages:
    302
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hi, thanks for the reply...
     
    ranacseruet, Feb 15, 2009 IP
  4. MMJ

    MMJ Guest

    Messages:
    460
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #4
    MMJ, Feb 15, 2009 IP
  5. dimitar christoff

    dimitar christoff Active Member

    Messages:
    882
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    90
    #5
    dimitar christoff, Feb 15, 2009 IP
  6. MMJ

    MMJ Guest

    Messages:
    460
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Yeah, it just came to mind, a bit random tbh :)
     
    MMJ, Feb 15, 2009 IP
  7. dimitar christoff

    dimitar christoff Active Member

    Messages:
    882
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    90
    #7
    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
     
    dimitar christoff, Feb 15, 2009 IP
  8. MMJ

    MMJ Guest

    Messages:
    460
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #8
    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).
     
    MMJ, Feb 15, 2009 IP
  9. dimitar christoff

    dimitar christoff Active Member

    Messages:
    882
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    90
    #9
    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.
     
    dimitar christoff, Feb 15, 2009 IP