日期:2014-05-16  浏览次数:20635 次

jquery的$getjson获取ajax怎么没有效果?
<!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>
</head>
<script type="text/javascript" src="jquery-1.7.2.min.js"></script>
<script type="text/javascript">
$(function(){
$("button").click(function(){
$.getJSON("ajax6.asp",function(data){
$("#pig").html(data.name);
});
});
});
</script>
<body>
<button>click</button>
<div id="pig"></div>
</body>
</html>


其中ajax6.asp为
<%
response.Write("{name:'peter',age:18}");
%>为什么获取不了啊,我想获取asp的json


------解决方案--------------------
key 和 value 需要双引号

response.Write("{""name"":""peter"",""age"":""18""}")