<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!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=gb2312" />
<title>无标题文档</title>
<SCRIPT src="/skin/skin_qide/js/jquery-1.7.2.min.js" type=text/javascript></SCRIPT>
<script>
$(function(){
$(document).on('click','.button2',function(){
$.ajax({
url: "http://xiangxinghua.localhost:8088/1.asp",
jsonpCallback: "showPrice",
jsonp: "callback",
dataType: "jsonp",
data: {
},
// work with the response
success: function( data ) {
console.log( data ); // server response
alert('我是本地函数,远程js带来的数据是:' + data.success);
}
});
});
});
</script>
</head>
<body>
<input type="button" value="提交" id="button2" class="button2"/>
</body>
</html>
然后
http://xxx.com/1.asp
就返回json数据:
response.Write(" showPrice({""success"":true,""result"":""ok""}) ")
记得使用showPrice()函数包含json数据
刚刚测试出来,记录起来以免以后忘记了