jquery+ajax+json+asp.net学习笔记(一)
jquery中已经封装了ajax的过程,使用起来很简单:
通过get方式提交:
<html>
<head>
<title>实现服务器时间实时变化</title>
<script language="javascript" type="text/javascript" src="js/jquery-1.3.1.js"></script>
<script language="javascript" type="text/javascript">
$(document).ready(function(){
$("#gettime").click(function(){
setInterval(function(){getcurtime()},1000);//settimeout和setinterval都是延迟一秒执行,但是settimeout不会每隔一秒执行一次,而setinterval可以实现
});
});
function getcurtime()
{
$.get("getCurTime.aspx",function(response){
$("#curtime").text(response);});
}
</script>
</head>
<body>
<div id="gettime">click here to get current time</div>
<div id="curtime"></div>
</body>
</html>
以上代码实现了时间的实时刷新,但是我记得以前用settimeout和setinterval都可以实现实时刷新,但是我在本地测试的结果是settimeout不能实现此功能,只能实现推迟,不知道是什么原因,希望高手指点
相关文档:
asp.net的错误--Failed to access IIS metabase 收藏
Server Error in '/sdxx' Application.
--------------------------------------------------------------------------------
Failed to access IIS metabase.
Description: An unhandled exception occurred during the execution of the current web ......
AJAX中文问题分为两大类:
1)发送路径中的参数有中文,在服务器段接收参数值是乱码
例如:
var url="a.jsp?name=小李";
xmlHTTP.open ("post",url,true);
解决办法:
利用javascript的提供的escape()或encodeURI()方法
例如:
客户端:
var url="a.jsp?name=小李";
url=encode ......
<html>
<head>
<title>new ajax</title>
<mce:style type="text/css"><!--
body{
margin-top:50px;
}
.MyDiv{
font-size:12px;
border:1px solid #DDD;
background-color:#FFD;
margin:2px;
width:200px;
}
--></mce:style><style type="t ......
工具:myeclipse 6.5
json中文官方:http://www.json.org/json-zh.html
新建项目webs,在WebRoot下新建目录json
xml的解析方式:
------------------------------------------------------------------
1.新建NewFile.xml
<?xml version="1.0" encoding="UTF-8"?>
<userinfo>
  ......