Ask a questionAsk a question
 

QuestionGet form submit response

  • Wednesday, November 04, 2009 9:35 AMweirdo.cn Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi All,

    how to get the response from the form submit? For example, I have a form, fill in the data and then click submit, what I want is to get the response from the remote server, I need to parse the returned HTML. So what I want to get is the response of the remote web server. Note, I submit the form using JS:

    form1.submit();

    Then, I want to get the response from the server. Please kindly give me the answer or direct me to right place for this issue. Thanks!


All Replies

  • Wednesday, November 04, 2009 9:55 PMJamesChambers Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hello,

    We'll likely need a little more info before we can proceed with an answer here.

    What JS libraries are you using?  This will influence your method of parsing the result.

    Do you need to handle the response in the browser, or can you use a server-side method to capture and parse the result into a type of your making?  If you're using .Net, this will almost certainly be your most efficient route.  You can signal through the AJAX libraries to make the call, even send form data behind the scenes if you like.

    What kind of parsing are you trying to accomplish, as in, is it simple text extraction?  Is there another way to query the target server (i.e. web service)?

    Cheers,
    -jc



    Me, coding and stuff: Mr. James
  • Thursday, November 05, 2009 2:09 AMweirdo.cn Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Thanks for the reply James! Let me explain more on this:

    The only way I can query the target server is using a form, and yes I'm sending data behind the scene, using a normal JS script, and lines of my JS are like following:

    document.getElementById("dataA").value = "A";
    document.getElementById("dataB").value = "B";
    document.getElementById("dataC").value = "C";
    document.getElementById("form1").submit();

    Then the target server will return with the requested results. What I want to do is, capture the returned HTML, and do some text extraction, and then show only the extracted text in my browser.

    If there's any way to do this, please kindly give me some sample. Thanks a lot.