<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%> <html> <head> <title>Board List</title> <script type="text/javascript" src="js/jquery-1.7.1.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $('input').click(function(){ $.ajax({ type:"GET", url:"jsp/jQuery/data.html", success:function(json){ //alert(json); var tranMsg = jQuery.parseJSON(json); alert(tranMsg.msg + "\r\n" + tranMsg.data); } }) }); }); </script> </head> <body> <div id="content"></div> <p></p> <input type="button" name="btn" value="click"/> </body> </html> |
[참고] : jQuery API
data.html
{"msg":"ok", "data":"hi~ jQuery.ajax"} |
결과
'프로그램 > jQuery' 카테고리의 다른 글
jqGrid (0) | 2012.03.22 |
---|---|
jQuery ajax (0) | 2012.03.15 |
traverse(탐색) (0) | 2012.03.13 |
filter (0) | 2012.03.13 |
selector (0) | 2012.03.13 |