Function CreateXmlHttp ()
{
Var A = null;
Try
{
A = new ActiveXObject ("Msxml2.XMLHTTP ");
}
Catch (e ){
Try
{
A = new ActiveXObject ("Microsoft. XMLHTTP ");
}
Catch (oc ){
A = null;
}
}
If (! A & typeof XMLHttpRequest! = "Undefined ")
{
A = new XMLHttpRequest ();
}
Return;
}
// Update user profile information
Function editDigital (username, digital)
{
Var xmlHttp;
XmlHttp = CreateXmlHttp ();
XmlHttp. open ("post", "http://www.ideacool.net/service/ajax.asmx/updateUserDigital", false );
XmlHttp. setRequestHeader ("Content-Type", "application/x-www-form-urlencoded ");
XmlHttp. Send ("digital =" + digital + "& username =" + username );
If (xmlHttp. status! = "200 ")
{
Alert ("an error occurred! ");
}
Else
{
Xml = xmlHttp. responseText;
Var xmldoc = new ActiveXObject ("Microsoft. XMLDOM ");
Xmldoc. async = false;
Xmldoc. loadXML (xml );
Var rootElement=xmldoc.doc umentElement;
Var result = rootElement. text;
If (result = "error ")
{
Alert ("modification failed! ");
}
Else
If (result = "OK ")
{
Alert ("My profile is modified successfully! ");
}
}
}
Function showIdeaList (cid, nPageNo, nPageNum)
{
Please wait Doc ument. getElementById ("IdeaList"). innerHTML = "loading idea ...";
Var xmlHttp;
XmlHttp = CreateXmlHttp ();
XmlHttp. onreadystatechange = function (){
If (xmlHttp. readyState = 4)
{
If (xmlHttp. status! = "200 ")
{
Invalid Response Doc ument. getElementById ("IdeaList"). innerHTML = "loading error ";
}
Else
{
Xml = xmlHttp. responseText;
Optional parameter Doc ument. getElementById ("IdeaList"). innerHTML = xml;
}
}
}
XmlHttp. open ("POST", "http://www.ideacool.net/service/getIdeaList.asp", true );
XmlHttp. setRequestHeader ("Content-Type", "application/x-www-form-urlencoded ");
XmlHttp. Send ("cid =" + cid + "& page =" + nPageNo + "& pageNum =" + nPageNum );
}