Hi All,
I m new to Ajax. I m trying to print some
string in a text field which i get from my
servlet.
response.getWriter().write("sample output");
I have set the content type as text.
In my javascript i ve the following code
ajaxRequest.onreadystatechange = function(){
if(ajaxRequest.readyState == 4){
document.myForm.time.value = ajaxRequest.responseText;
}
}
ajaxRequest.open("GET", "http://localhost:8080/SampleServletProject/my.do", true);
ajaxRequest.send(null);
i ve a text field in my html that calls this method.
I m able to get the text output when i directly run the servlet in my mozilla. But not in the text field that i want. What is the error here?
Should i include any request header in my XMLHttpRequest object?
Thanks in advance