现在的位置: 首页 > 综合 > 正文

ajax json 模板

2011年05月04日 ⁄ 综合 ⁄ 共 1150字 ⁄ 字号 评论关闭

ajax json 模板

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script src="jquery-1.4.4.min.js" language="javascript" type="text/javascript">
</script>
<script type="text/javascript">
function load()
{
alert(
"test");
hotsearch(
"http://api.t.sina.com.cn/users/show/wangkangluo1.json?source=3153373932");
}

function hotsearch(index)
{
if (window.XMLHttpRequest)
{
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
//sortname = encodeURI(sortname);
}
else
{
// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
//sortname = encodeURI(sortname);
}
//q = encodeURI(type);
gScriptObj = document.createElement("script");
gScriptObj.setAttribute(
"type", "text/javascript");
gScriptObj.setAttribute(
"charset", "utf-8");
//if(index ==1)
//{
gScriptObj.setAttribute("src", index);
headObj
= document.getElementsByTagName("head").item(0);
headObj.appendChild(gScriptObj);
}

function json_back(json)
{
alert(json);
}


</script>
</head>

<body onload="load()">
<div class="me">test</div>
</body>
</html>

抱歉!评论已关闭.