Ajax使用jquery的实现.docVIP

  • 1
  • 0
  • 约4.38千字
  • 约 4页
  • 2017-12-20 发布于河南
  • 举报
Ajax使用jquery的实现

页面部分: %@ page language=java import=java.util.* pageEncoding=utf-8% % String path = request.getContextPath(); String basePath = request.getScheme()+://+request.getServerName()+:+request.getServerPort()+path+/; % !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN html head base href=%=basePath% titleMy JSP testAjax.jsp starting page/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 !-- link rel=stylesheet type=text/css href=styles.css -- script type=text/javascript src=ajax/jquery-1.7.min.js /script script type=text/javascript $(document).ready(function(){ $(#sub1).click(function(){ $.ajax({ type: POST, url: ajax/TestAjax-execute?userName=+$(.userName).val(), data: name=+$(.uuu).val()+stu=+$(.fff).val(), success: function(msg){ alert(msg); document.getElementById(in2).value(RRRRRRR); } }); }); }); /script /head body form action= id=from1 用户名:input id=in1 type=text class=userName context1:input id=in2 type=text class=uuu context2:input id=in3 type=text class=fff input type=submit value=GO id=sub1 /form hr input id=in2 type=text value= /body /html 后台部分: package com.wepull.ajax.jquery; import java.io.IOException; import java.io.PrintWriter; import java.util.Date; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class TestJqueryAjax extends HttpServlet { /** * Constructor of the object. */ public TestJqueryAjax() { super(); } public void destroy() { super.destroy(); // Just puts destroy string in log // Put your code here } public void doGet(HttpServletRequest request

文档评论(0)

1亿VIP精品文档

相关文档