Closed Thread
Results 1 to 4 of 4

Thread: Garbled $QUERY_STRING when form submitted using AJAX

  1. #1
    Join Date
    Apr 2008
    Posts
    2
    Rep Power
    0

    Angry Garbled $QUERY_STRING when form submitted using AJAX

    I'm trying to retrieve a value from a form with a single input: "formCameraIPAddress".
    When the form is submitted using GET, I get a nice "?formCameraIPAddress=whateverIEnterHere" in the url. And $QUERY_STRING comes out as whateverIEnterHere after I run it through sed (the cgi program is a shell script). However, when the form is submitted asynchronously using an ajax method that loads pages in a content area like this...
    Code:
    <input type="button" onClick="ajaxpage(myCGIGeneratedCameraDocument, 'contentarea')" value="Display camera" />
    ... instead of getting something sensible out, it parses $QUERY_STRING as a number like 1207527656700, that always starts with the same first few digits, but then has completely random digits every time I invoke the script. It's driving me nuts that this form works synchronously, but not asynchronously, and that the query string gives a random number each time, so I'm stuck for debugging ideas!

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    fahlyn's Avatar
    fahlyn is offline Learning Programmer
    Join Date
    Nov 2007
    Posts
    35
    Rep Power
    0

    Re: Garbled $QUERY_STRING when form submitted using AJAX

    Can you post the body of your javascript "ajaxpage" method?

    Ajax isn't actually going to "submit" a form as a normal html form would submit, you actually have to construct the URL that you want to invoke. So, my gut feeling is that your "ajaxpage" method doesn't include all of your form fields as a normal GET request from submitting a form would do.
    Visit My Google Group Here: Web Development Innovation

  4. #3
    Join Date
    Apr 2008
    Posts
    2
    Rep Power
    0

    Re: Garbled $QUERY_STRING when form submitted using AJAX

    Yes, you're right. I've realised that the function isn't actually submitting a form at all. I'll have to construct the URL myself - not too hard, but I wish I had realised this several hours ago. :S

  5. #4
    fahlyn's Avatar
    fahlyn is offline Learning Programmer
    Join Date
    Nov 2007
    Posts
    35
    Rep Power
    0

    Re: Garbled $QUERY_STRING when form submitted using AJAX

    You may want to look into the serialize function that Prototype offers...that should allow you to dynamically build a query string based on all of your form fields. It may save you some manual work.
    Visit My Google Group Here: Web Development Innovation

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Why this form is submitted if condition doesn't hold true???
    By justsachin4u in forum JavaScript and CSS
    Replies: 3
    Last Post: 07-17-2011, 07:31 AM
  2. Replies: 7
    Last Post: 09-16-2010, 11:12 AM
  3. Where is the submitted info sent? How can I send it to email?
    By whaatup in forum JavaScript and CSS
    Replies: 12
    Last Post: 08-04-2010, 05:36 PM
  4. Ajax Form Help (validation and tips)
    By antonypeiris in forum AJAX
    Replies: 8
    Last Post: 01-26-2010, 05:24 PM
  5. Replies: 1
    Last Post: 11-19-2007, 09:42 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts