Reputation:
I am not able to receive request on jsp page which i send from html page.
I verified on Chrome's Inspect element
that request was successfully send, and the i noted the Request URL and i found that url was reachable( and correct).
I can say this because i pasted this url in browser and the resulting page that opened from Request URL was my jsp page.
So i could not figure out why and where i am making mistake, so that request is not going to jsp.
Some relevant piece of code:
html content
var url = "test.jsp";
xmlhttp.open("GET",url,true);
xmlhttp.send();
Inspect element's Network tab content:
Request URL: /MusicShopping/test.jsp
( http://localhost:14443 before /MusicShopping too)
Request Method:GET
Status Code:200 OK
Green ball before 200 appeared
jsp file contain only line of plain text. (If i manually copy paste request url in browser my jsp page is displayed).
Please let me know where can be the problem
Upvotes: 0
Views: 574
Reputation: 58
Seems like the request is sent, but nothing is done with response. Did you register a callback for onreadystatechange of XMLHttpRequest so that, when your AJAX request state changes the callback method will run and there you can check for readyStatus 4 and 200 page status and parse the response.
Please have a look into this
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
}
}
Upvotes: 1