how to post the values to the form whose action is in javascript?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mani

    how to post the values to the form whose action is in javascript?

    Hi

    I am trying to post the values to the form. The form action is not
    done in html i.e not in form tag, it is done by javascript code using
    document.FORMNA ME.action = "results.as p";

    I think in that results.asp file, they are creating one xml file for
    the posted values and these xml file has been redirected to some other
    asp file. for ex, displayresults. asp to show the results.

    My actual flow is...

    I am searching some "example" content in http://example.com/
    example.asp and i am getting answers for the searched "example" in
    http://example.com/displayresults.asp. Before getting the answer in
    the page, i can see http://example.com/example.asp redirecting to
    http://example.com/results.asp and then finally getting answer in
    http://example.com/displayresults.asp.

    I tried to achieve/get the content by posting the values through CURL,
    but i didnt get the content. When i echoed the content i can see that
    my posted values has been passed/set perfectly. I have doubt on
    javascript action....not sure only because of this action.


    Code:

    curl_setopt($ch , CURLOPT_POST, 1);
    curl_setopt($ch ,CURLOPT_POSTFI ELDS,$postvalue s);
    curl_setopt($ch ,CURLOPT_COOKIE JAR,$fpath.'/example.txt');
    curl_setopt($ch ,CURLOPT_FOLLOW LOCATION,0);
    curl_setopt($ch , CURLOPT_HEADER , 1);
    curl_setopt($ch , CURLOPT_RETURNT RANSFER,1);

    I dont know whether i have to set the redirection param or something
    else.

    Can anyone please teach me how to proceed with this?

  • Mani

    #2
    Re: how to post the values to the form whose action is in javascript?

    Got the solution.

    Comment

    • Captain Paralytic

      #3
      Re: how to post the values to the form whose action is in javascript?

      On 2 Feb, 10:39, "Mani" <maniraj...@gma il.comwrote:
      Got the solution.
      Care to share it?

      Comment

      • Mani

        #4
        Re: how to post the values to the form whose action is in javascript?

        On Feb 2, 3:42 pm, "Captain Paralytic" <paul_laut...@y ahoo.comwrote:
        On 2 Feb, 10:39, "Mani" <maniraj...@gma il.comwrote:
        >
        Got the solution.
        >
        Care to share it?
        In the beginning, I was trying http://example.com/ as URL to get the
        content. But i didnt get the content. After that, I picked the form
        action value and necessary varible values [which will be passed to the
        form action ] from the http://example.com/ source [ Javascript
        section ].

        Then, I used http://example.com/ACTIONVALUE as url with necessary
        javascript variables as post values for the CURL operation and got the
        expected content sucessfully.

        Comment

        Working...