第一种方式:
http://www.open-open.com/lib/view/open1334026513327.html
html代码:
<html>
<head>
<title>JQuery学习</title>
<script src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#btnTest").click(function(){
$("#result").html("loading...........").css("color","red");
$.getScript("http://localhost:3301/web/Default4.aspx",
function(){
$("#result").html("name:" + jimmy.name + "<br/>email:" + jimmy.email).css("color","black");
});
});
});
</script>
</head>
<body>
<button id="btnTest">BtnTest</button>
<div id="result"></div>
</body>
</html>
<head>
<title>JQuery学习</title>
<script src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#btnTest").click(function(){
$("#result").html("loading...........").css("color","red");
$.getScript("http://localhost:3301/web/Default4.aspx",
function(){
$("#result").html("name:" + jimmy.name + "<br/>email:" + jimmy.email).css("color","black");
});
});
});
</script>
</head>
<body>
<button id="btnTest">BtnTest</button>
<div id="result"></div>
</body>
</html>
default4.cs代码:
Response.Write("var jimmy = {name:\"jimmy.yang\",email:\"jimmy.yang@163.com\"}");