jquery Ajax 全域性呼叫封裝
阿新 • • 發佈:2018-12-21
<!DOCTYPE html><html> <head> <base href="<%=basePath%>"> <title>jQuery Ajax封裝通用類測試</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <jsp:include page="/view/common/js_taglib.jsp"></jsp:include> <script type="text/javascript"> $(function(){ $.ax( getRootPath()+"/test/ajax.html", null, null, null, null, function(data){ alert(data.code); }, function(){ alert("出錯了"); } ); $.axpost(getRootPath()+"/test/ajax.html", null, function(data){ alert(data.data); }); $.axspost(getRootPath()+"/test/ajax.html", null, function(){ alert("成功了"); }, function(){ alert("出錯了"); }); }); </script> </head> <body> </body></html>