手抄报 安全手抄报 手抄报内容 手抄报图片 英语手抄报 清明节手抄报 节约用水手抄报

jQuery对ajax的支持

时间:2024-10-13 13:31:48

1、<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

jQuery对ajax的支持

2、<script type="text/javascript">$(function(){$('a[class=s1]').click(function(){var flight = $(this).parent().siblings().eq(0).text();$(this).next().load('order.do',{'flight':flight});});})

jQuery对ajax的支持

3、<table cellpadding='0' cellspacing='0' width='80%' border='1px'><thead><tr><td>航班号</td><td>机型</td><td>票价</td></tr></thead><tbody><tr>

jQuery对ajax的支持

4、<td>CA747</td><td><挢旗扦渌;a href="#"媪青怍牙>波音客机</a></td><td><a href="javaScript:;" class='s1'>查看所有票价</a><div></div></td></tr><tr><td>MU193</td><td><a href="#">空客客机</a></td><td><a href="javaScript:;" class='s1'>查看所有票价</a><div></div></td></tr></tbody></table>

jQuery对ajax的支持

5、public class ActionServlet extends HttpServlet{@Overrideprotecte颊俄岿髭d void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {//post请求,解决乱码request.setCharacterEncoding("utf-8");response.setContentType("text/html;charset=utf-8");//获取请求地址PrintWriter out=response.getWriter();String path=request.getRequestURI();

jQuery对ajax的支持

6、String action=path.substring(path.lastIndexOf("/"),path.lastIndexOf("."));if(action.equalsIgnoreCase("/order")){String flight=request.getParameter("flight");if(flight.equals("CA747")){out.println("经济舱:345¥</br>头等舱:556¥");}else{out.println("经济舱:432¥</br>头等舱:879¥");}}}}

jQuery对ajax的支持
© 手抄报圈