Hi,
I need to evaluate the return result of a function from Server.aspx as following. But it doesn't work as I need
[CODE=javascript]function getAjax()
{
var XmlHttp;
//Creating object of XMLHTTP in IE
try
{
XmlHttp = new ActiveXObject(" Msxml2.XMLHTTP" );
}
catch(e)
{
try
{
XmlHttp = new ActiveXObject(" Microsoft.XMLHT TP");
}
catch(oc)
{
XmlHttp = null;
}
}
//Creating object of XMLHTTP in Mozilla and Safari
if(!XmlHttp && typeof XMLHttpRequest != "undefined" )
{
XmlHttp = new XMLHttpRequest( );
}
return XmlHttp;
}
function GetBanType()
{
rnd++;
url = 'Server.aspx?ac tion=GetBan&ses sion=' + rnd ;
var re = getAjax();
re.onreadystate change = function(){
if( re.readyState == 4 && re.status == 200 )
{
if(re.responseT ext != "")
{
if (re.responseTex t == "special value")
{
....
[/CODE]
Actually, re.responseText returns:
"Gag
<br />
<br />
<br />
<br />
<br />
<br />
"
while I'm expecting only "Gag" word.
Could I know how I can subtract only the first word of the return result? Or, is there any general solution to get a proper result from server .aspx
Any idea is appreciated.
I need to evaluate the return result of a function from Server.aspx as following. But it doesn't work as I need
[CODE=javascript]function getAjax()
{
var XmlHttp;
//Creating object of XMLHTTP in IE
try
{
XmlHttp = new ActiveXObject(" Msxml2.XMLHTTP" );
}
catch(e)
{
try
{
XmlHttp = new ActiveXObject(" Microsoft.XMLHT TP");
}
catch(oc)
{
XmlHttp = null;
}
}
//Creating object of XMLHTTP in Mozilla and Safari
if(!XmlHttp && typeof XMLHttpRequest != "undefined" )
{
XmlHttp = new XMLHttpRequest( );
}
return XmlHttp;
}
function GetBanType()
{
rnd++;
url = 'Server.aspx?ac tion=GetBan&ses sion=' + rnd ;
var re = getAjax();
re.onreadystate change = function(){
if( re.readyState == 4 && re.status == 200 )
{
if(re.responseT ext != "")
{
if (re.responseTex t == "special value")
{
....
[/CODE]
Actually, re.responseText returns:
"Gag
<br />
<br />
<br />
<br />
<br />
<br />
"
while I'm expecting only "Gag" word.
Could I know how I can subtract only the first word of the return result? Or, is there any general solution to get a proper result from server .aspx
Any idea is appreciated.
Comment