日期:2014-05-16 浏览次数:20903 次
<?xml version="1.0" encoding="UTF-8"?> <!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" xml:lang="en" lang="en"> <head> <title>jquery--getJSON方法实现ajax功能</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> <script type="text/javascript" src="../../scripts/jquery-1.4.2.js"></script> <script type="text/javascript"> $(function() { $("#button1").click(function() { alert("java"); //打开文件,并通过回调函数处理获取的数据 $.getJSON("userInfo.json", function(data) { alert("json"); }); }); }); </script> </head> <body> <div class="divTitle"> <input type="button" id="button1" value="获取数据"/> </div> <div id="divTip"></div> </body> </html>