日期:2014-05-16 浏览次数:20659 次
<script type="text/javascript"> window.onload = function() { try { var xmlhttp = new XMLHttpRequest(); } catch(e) { var xmlhttp = new ActiveXObject('Microsoft.XMLHTTP'); } xmlhttp.open('GET','WebForm1.aspx',true); xmlhttp.setRequestHeader('COOKIE','author=Robin Chen'); xmlhttp.onreadystatechange=function() { document.body.innerHTML+='<div>readyState:'+xmlhttp.readyState+'</div>'; if(xmlhttp.readyState == 4 && xmlhttp.status == 200) { document.body.innerHTML+='<div>responseText:'+xmlhttp.responseText+'</div>'; //alert(xmlhttp.responseText); //这句打印出来把前台页面都打印出来了 } } xmlhttp.send(); } </script>
string strName = HttpContext.Current.Request.QueryString["author"]; //这个author值得不到 string strRes = "This is the response from the server:\r\n" + "Hello, " + strName + "!"; HttpContext.Current.Response.Clear(); HttpContext.Current.Response.Write(strRes); HttpContext.Current.Response.Flush(); HttpContext.Current.Response.End();
$(document).ready(function() { $.get("WebForm1.aspx",function(data){ $("body").html(data); }); });