Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



How to retrieve Response from HTML and PHP pages

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 02-02-2009
Member
 
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>
.....

Reply With Quote
  #2  
Old 02-02-2009
Member
 
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.
Reply With Quote
  #3  
Old 02-02-2009
Member
 
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.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


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


All times are GMT +5.5. The time now is 04:03 AM.