代码如下:
javascript端:
var e;
var yy = document.getElementById("Text1").value;
try { xmlRequest = new XMLHttpRequest(); // IE7 & Mozilla } catch (e) { try { xmlRequest = new ActiveXObject("Microsoft.XMLHTTP"); // IE6 , IE5 } catch (e) { } }
xmlRequest.open("GET", "GetIndexCodeService.aspx?name="+yy,true); // true表示异步回调 xmlRequest.onreadystatechange = CallbackComplete; // 当readyState改变的时候,调用CallbackComplete函数 xmlRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xmlRequest.send(null); C#端:
string name = Page.Request.QueryString["name"];
现在发现如果参数yy是中文,就无法正确获得该参数值,请问如和处理?能否给段完整代码?谢谢
javascript端:
var e;
var yy = document.getElementById("Text1").value;
try { xmlRequest = new XMLHttpRequest(); // IE7 & Mozilla } catch (e) { try { xmlRequest = new ActiveXObject("Microsoft.XMLHTTP"); // IE6 , IE5 } catch (e) { } }
xmlRequest.open("GET", "GetIndexCodeService.aspx?name="+yy,true); // true表示异步回调 xmlRequest.onreadystatechange = CallbackComplete; // 当readyState改变的时候,调用CallbackComplete函数 xmlRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xmlRequest.send(null); C#端:
string name = Page.Request.QueryString["name"];
现在发现如果参数yy是中文,就无法正确获得该参数值,请问如和处理?能否给段完整代码?谢谢
var eYY = encodeURIComponent(yy);....
xmlRequest.open("GET", "GetIndexCodeService.aspx?name="+eYY,true);