1. Ajax Code
1 function Selectsemesterbyschyear () {2 //alert (' sssssss ');3 varTemp1 = document.getElementById ("ctl00_contentplaceholder1_text_city"). Value;4 $.ajax ({5Type"Get", 7 URL: "hospitalhandler.ashx?city=" + encodeURI (TEMP1),//place to encode8 success:function (Strjson) {9$("#ctl00_ContentPlaceHolder1_selectHospital"). empty ();Ten$("#ctl00_ContentPlaceHolder1_selectHospital"). Prop ("Disabled",false); One varDataArray =eval (Strjson); A for(vari =0; i < dataarray.length; i++) { -$("#ctl00_ContentPlaceHolder1_selectHospital"). Append ("<option value= '"+ Dataarray[i]. H_ID +"' >"+ Dataarray[i]. H_name +"</option>"); - } the }, - error:function (XMLHttpRequest, Textstatus, Errorthrown) { - alert (xmlhttprequest.responsetext); - } + }); -}
2,ashx page Receive
1 string City = context. Server.urldecode (context. request["City"]. ToString ());
3, no matter how, to JS first code, to ensure that the value will not appear garbled.
Using the Ajax value parameter is Chinese can be garbled