POST a form with XmlHttpRequest

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Henri-Bastien

    #1

    POST a form with XmlHttpRequest

    ok here is my problem I have a form in a webpage that I want to submit
    and get the result back without reloading the page.

    I've seen many times ppl using text/x-www-form-urlencode but I was
    wondering if it was possible somehow to submit the form element
    directly so I wouldn't have to process the form to put it in a string.

    If there is anyway I would be happy if not seems I'll have to
    transform the form into a string request.

    Thanks in advance for your help.
  • Martin Honnen

    #2
    Re: POST a form with XmlHttpRequest



    Henri-Bastien wrote:
    [color=blue]
    > If there is anyway I would be happy if not seems I'll have to
    > transform the form into a string request.[/color]

    XMLHttpRequest is mostly meant to exchange XML as data so you can
    directly pass a DOM node like an XML DOM document to the send method but
    if you want to send form data as application/x-www-form-urlencoded
    content then you have to build that string yourself from the form that
    you can walk with the DOM to build the string.

    --

    Martin Honnen
    http://JavaScript.FAQTs.com/

    Comment

    • Metaphis

      #3
      Re: POST a form with XmlHttpRequest

      I don't need to send it in x-www-fomr-urlencoded only thing I need is
      to get the same result as doing form.submit without having to reload
      the page AND being able to get the result back. Because the script run
      localy but I access a remote page. For that reason I can't simply put
      the form in an other frame because DOM doesn't allow that in
      explorer....

      Comment

      Working...