M
mihirnmehta
This is my code
function getDetails()
{
var name = document.getElementById("movie_name").value;
if (window.XMLHttpRequest) //For Mozilla Browsers
{
XMLHttp=new XMLHttpRequest()
}
else if (window.ActiveXObject) // For Microsoft Browsers
{
XMLHttp=new ActiveXObject('Microsoft.XMLHTTP')
}
var
url="http://localhost/WebService1/Service.asmx/GetMovieByName";
var params="name=" + name;
XMLHttp.open("POST",url,true);
XMLHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
XMLHttp.setRequestHeader("Content-Length", params.length)
XMLHttp.onreadystatechange=stateChanged ;
XMLHttp.send(params);
}
function stateChanged()
{
if (XMLHttp.readyState==4 || XMLHttp.readyState=="complete")
{
var v = document.getElementById("responseDiv");
v.innerHTML = XMLHttp.responseText;
}
}
and there a division like
<div id="responseDiv" align=center>
</div>
below in the page.
Now i have checked that my webservice returns the proper html snippet
as string and that the XMLHttp.responseText contains proper html
snippet(a table). But it is displayed as text . The html is correctly
displayed but i want it to show the table rather than the html code?
Can anybody help me out.
Thanks
function getDetails()
{
var name = document.getElementById("movie_name").value;
if (window.XMLHttpRequest) //For Mozilla Browsers
{
XMLHttp=new XMLHttpRequest()
}
else if (window.ActiveXObject) // For Microsoft Browsers
{
XMLHttp=new ActiveXObject('Microsoft.XMLHTTP')
}
var
url="http://localhost/WebService1/Service.asmx/GetMovieByName";
var params="name=" + name;
XMLHttp.open("POST",url,true);
XMLHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
XMLHttp.setRequestHeader("Content-Length", params.length)
XMLHttp.onreadystatechange=stateChanged ;
XMLHttp.send(params);
}
function stateChanged()
{
if (XMLHttp.readyState==4 || XMLHttp.readyState=="complete")
{
var v = document.getElementById("responseDiv");
v.innerHTML = XMLHttp.responseText;
}
}
and there a division like
<div id="responseDiv" align=center>
</div>
below in the page.
Now i have checked that my webservice returns the proper html snippet
as string and that the XMLHttp.responseText contains proper html
snippet(a table). But it is displayed as text . The html is correctly
displayed but i want it to show the table rather than the html code?
Can anybody help me out.
Thanks