// JavaScript format
Function btnclick (){
VaR XMLHTTP;
Function createxmlhttprequst (){
If (window. activexobject ){
XMLHTTP = new activexobject ("Microsoft. XMLHTTP ");
}
Else if (window. XMLHttpRequest ){
XMLHTTP = new XMLHttpRequest ();
}
If (! XMLHTTP ){
Alert ('create XMLHTTP exception ');
}
XMLHTTP. Open ("Post", "getdate. ashx", false );
XMLHTTP. onreadystatechange = function (){
If (XMLHTTP. readystate = 4 ){
If (XMLHTTP. Status = 200 ){
Document. getelementbyid ("text1"). value = XMLHTTP. responsetext;
}
Else {
Alert ('ajax server return error ');
}
}
};
XMLHTTP. Send ();
}
// Jqurery format
$ (Function (){
$ ("# Btnget"). Click (function (){
VaR sum = $ ("# text1"). Val ();
VaR type = $ ("# select1"). Val ();
VaR XMLHTTP;
Function createxmlhttprequst (){
If (window. activexobject ){
XMLHTTP = new activexobject ("Microsoft. XMLHTTP ");
}
Else if (window. XMLHttpRequest ){
XMLHTTP = new XMLHttpRequest ();
}
If (! XMLHTTP ){
Alert ('exception in creating XMLHTTP object ');
}
XMLHTTP. Open ("get", "gethuilv. ashx? Num = "+ sum +" & type = "+ type, false );
XMLHTTP. onreadystatechange = function (){
If (XMLHTTP. readystate = 4 ){
If (XMLHTTP. readystatus = 200 ){
$ ("# Text2"). Val (XMLHTTP. responsetext );
}
Else {
Alert ('ajax server return error ');
}
}
}; XMLHTTP. Send ();
});
});