Tuesday, 14 June 2016

Easy Learn AJAX- Beginners AJAX Tutorials Part 5- Server Response Method

Hi Friends

In this section will see that how to Server Response to browser(client) and what basics response come back to browser

AJAX Server Response to browser

There are two methods property in server response
1.responseText
2.responseXML



the above XMLHttpRequest object to get response data as  string than we can use above method in following way
             xhttp.responseText

the above XMLHttpRequest object to get response data as  XML than we can use above method in following way
            xhttp.responseText

Ok fine!

Then how to use this code in script and how to update particular part without reloading the whole webpage

document.getElementById("updateArea").innerHTML = xhttp.responseText;
document.getElementById("updateArea").innerHTML = xhttp.responseTextXML;

This above code inside the onreadystatechange event like it

xhttp.onreadystatechange = function()
 {
    if (xhttp.readyState == 4 && xhttp.status == 200) {
      document.getElementById("updateArea").innerHTML = xhttp.responseText;
    }

  };

Next section will post Live time example scripts 

Thank You!

No comments:

Post a Comment

What is AI- Artificial Intelligence - தமிழில்

Artificial Intelligence : Artificial intelligence leverages computers and machines to mimic the problem-solving and decision-making capabili...