Generic handler CodestringLogin_name = context. request["login_name"]. Trim ();BLLs Data=NewBLLs (); stringselect_id ="Select use_id from sq_sgxhcom.fru_users where [email protected]"; intuse_id = Convert.ToInt32 (data. Select (select_id, login_name). tables[0]. rows[0][0]); stringAA ="Select Use_name,use_realname from sq_sgxhcom.fru_users where [email protected]"; stringName = data. Select (AA, use_id). tables[0]. rows[0][0]. ToString (); stringRealname = data. Select (AA, use_id). tables[0]. rows[0][1]. ToString (); stringCCC ="Select Use_name,use_realname from sq_sgxhcom.fru_users where Use_id=8"; stringname1 = data. Select (CCC). tables[0]. rows[0][0]. ToString (); stringrealname1 = data. Select (AA, use_id). tables[0]. rows[0][1]. ToString (); stringAAA ="[<k>\ "name\": \ "{0}\", \ "realname\": \ "{1}\" </k>,<k>\ "name\": \ "{2}\", \ "realname\": \ "{3}\" </k>]";//To spell the data in JSON string format returnstr=string. Format (AAA, Name, realname,name1,realname1). Replace ("<K>","{"). Replace ("</K>","}");
Context. Response.Write (RETURNSTR);
//JS Code
$.ajax ({type:"Post", URL:"Ajax/staff_manag.ashx?type=obtain_count", data: {login_type:login_type, login_name:login_name},Async:true, DataType:"JSON", success:function Fun (JSON) {alert ("I was"+json[0].name+"and the"+json[1].name+"a good friend."); } });
The value of a variable is spelled into a JSON-formatted string in the C # background general handler