// Cascade departments and queues
$ (Document). Ready (function (){
$ ("# Deptid"). Change (function (){
VaR deptid = $ ("# deptid"). Val ();
VaR url = "../leavewordmgr/leaveword. do? Act = queue & deptid = "+ deptid;
$. Ajax ({
URL: URL,
Type: 'post ',
Datatype :( $. browser. MSIE )? "Text": "XML", // accept data format
Timeout: 50000,
Error: function (){
Alert ("Access Database Error! ");
},
Success: function (data ){
VaR XML;
If (typeof DATA = "string "){
Xml = new activexobject ("Microsoft. xmldom"); // IE6, IE7 required, Firefox, IE8 not required
XML. async = false;
XML. loadxml (data );
} Else {
Xml = data;
}
VaR queue = Document. getelementbyid ("queueid ");
Queue. Options. Length = 0; // clear the queue
If (deptid! = & Quot; 999 & quot "){
Queue. Add (New Option ("all types", "999 "));
$ (XML). Find ("property"). Each (function (){
VaR value = $ (this). Find ("value"). Text ();
VaR text = $ (this). Find ("text"). Text ();
Queue. Add (New Option (text, value ));
});
}
}
});
});
});
Function setrate (){
$. Ajax ({
URL: 'setrateprocess. jsp ',
Type: 'post ',
Data: {flowrate: Document. getelementbyid ('flowrate'). Value },
Datatype: 'json ',
Success: function (MSG ){
If (msg. resultcode = "0 "){
Alert ('set successfully ');
Window. Close ();
} Else {
Alert ("setting failed ");
}
},
Error: function (XMLHttpRequest, textstatus, errorthrown ){
Alert (textstatus );
Alert ('set failed ');
}
});
}