Results 1 to 3 of 3

Thread: How to retrieve Response from HTML and PHP pages

  1. #1
    Join Date
    Jan 2009
    Posts
    134

    How to retrieve Response from HTML and PHP pages

    Hello all,

    I am trying to invoke js code that submit parameter to php page , but the result
    that the XMLHttpRequest Object captures is all the html of the page + the result from the php , Is I am wrong in this code?

    Code:
    var rqo;
    function setReq(v) {
    
       if (v != "") {
            document.getElementById("result").innerHTML = "Fetching " + v;
            rqo = new XMLHttpRequest();
            var qs = encodeURIComponent(v);
            var qry = "index.php?_data_input=" + qs;
            rqo.open('GET',qry,true);
            rqo.onreadystatechange = handleHttpResponse;
            rqo.send(null);
            return false;
        }
    }
    function handleHttpResponse() {
      var results = "";
      qq (rqo.readyState == 4) {
        results = rqo.responseText;
        document.getElementById("result").innerHTML = results;
      }
    
    }
    .....
    ....
     <div class="c3" id="result">
               &nbsp;
    </div>
    ....
      <form method="get" name="_main_form" >
                   <input type="text"size="50" name="_data_input" id="_data_input">
                   <input type="button" value="Get Item" onclick="aboutlang(document._main_form._data_input.value)">
                </form>
    .....

  2. #2
    Join Date
    Oct 2008
    Posts
    167

    Re: How to retrieve Response from HTML and PHP pages

    If you don't want PHP to do something then you have to prevent it from doing that. Once it's printed the result you want you don't want it to continue, right? So don't let it continue.

    Here's a hint: exit will stop execution dead in its tracks.

  3. #3
    Join Date
    Jan 2009
    Posts
    134

    Re: How to retrieve Response from HTML and PHP pages

    im not sure that technically its the right thing to do i just what using XMLHttprequest to catch the response from php the "<br> dddddddd </br>" string and innerHTML it to the result div but now its innerHTML all the page including the result to the result div.

Similar Threads

  1. How can I upload my html pages using filezilla
    By lovecraft in forum Technology & Internet
    Replies: 1
    Last Post: 24-03-2012, 04:37 PM
  2. how SSI technique use in html pages
    By Bansi_WADIA in forum Software Development
    Replies: 4
    Last Post: 28-01-2010, 02:11 AM
  3. How to add links to other pages in HTML
    By Camdean in forum Software Development
    Replies: 5
    Last Post: 19-01-2010, 02:41 PM
  4. Java program to retrieve html source
    By Aaliya Seth in forum Software Development
    Replies: 5
    Last Post: 12-01-2010, 10:59 AM
  5. Retrieve the response with POST
    By Happy46 in forum Software Development
    Replies: 3
    Last Post: 05-12-2009, 08:20 PM

Posting Permissions

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