www.webdeveloper.com
Results 1 to 4 of 4

Thread: Js redirect using $_post array?

  1. #1
    Join Date
    Mar 2010
    Posts
    78

    Js redirect using $_post array?

    Is there a way to use javascript to utilize the $_POST array instead of the
    $_GET array?

    I've got the following, which uses $_GET array, and I'd like to make it use $_POST instead:

    location.href="webpage1.php?my_fieldname=" + (my_fieldvalue);

  2. #2
    Join Date
    Dec 2003
    Location
    Bucharest, ROMANIA
    Posts
    15,428

  3. #3
    Join Date
    Mar 2010
    Posts
    78
    Quote Originally Posted by Kor View Post
    Thanks Kor. I'm looking into xmlhttprequest. It seems like quite a bit of work and there are apparently cross-browser issues to deal with also.

    I was wondering if there might be a javascript equivalent to the "method=post" that we all use on our forms; that could be used in a method similar to what I have used in the example above.

    I am submitting the page back to the server, so it's not like I need to transmit back to the server in the background.

  4. #4
    Join Date
    Dec 2003
    Location
    Bucharest, ROMANIA
    Posts
    15,428
    method is a FORM's attribute which can not be "mimed" nor sent within the address bar. You may pass the pairs name|value within the address bar as if you have submitted them using GET method, but this is possible only because the default submit method is GET, and the processing agent is instructed to take that into consideration. But the POST method is something else: it sends this information to the processing agent within the FORM's body itself or by the request object's argument. By short: either you use a classical submit action or you use the http request/ ActiveX object (with AJAX) in order to perform a POST submit.
    Last edited by Kor; 03-24-2010 at 12:59 PM.

Thread Information

Users Browsing this Thread

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

Posting Permissions

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



Recent Articles