博客
关于我
jQuery 调用 Ajax 实现查询的局部更新 (jsp + servlet + jQuery + Ajax)
阅读量:393 次
发布时间:2019-03-05

本文共 1785 字,大约阅读时间需要 5 分钟。

jQuery?Java Servlet??AJAX???????

???????????jQuery??Java Servlet?????????????????????????

??????

???????????HTML????????????

  • ??????????????
  • ????????AJAX??
  • ??????????????????

???????

    

????????

??????Java Servlet??????????

  • ???????????
  • ????????????
  • ?????????
  • ???????

    package com.syrdbt.system.servlet;import javax.servlet.ServletException;import javax.servlet.annotation.WebServlet;import javax.servlet.http.HttpServlet;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import java.io.IOException;@WebServlet("/TestAjaxServlet")public class TestAjaxServlet extends HttpServlet {    protected void doGet(HttpServletRequest request, HttpServletResponse response)            throws ServletException, IOException {        request.setCharacterEncoding("utf-8");        String name = request.getParameter("info");        System.out.println("?????? " + name);                if(name.equals("abc")) {            response.getWriter().print("success");        } else {            response.getWriter().print("failed");        }    }        protected void doPost(HttpServletRequest request, HttpServletResponse response)            throws ServletException, IOException {        doGet(request, response);    }}

    ??????

  • HTML????

    • ????jQuery?
    • ?????????ID???JavaScript??
  • JavaScript????

    $(function() {    $("#search").click(function() {        var value = $("#info").val();        $.ajax({            type: 'POST',            url: "TestAjaxServlet",            data: "info=" + value,            success: function(result) {                $("#show").html(result);            }        });    });});
  • ????????

    • ???????
    • ????????
    • ????
  • ?????

    ?????????????

  • ???????
  • ??????AJAX??
  • ???????????
  • ??????????
  • ??????????????????????????????HTML???????????????

    转载地址:http://fpkzz.baihongyu.com/

    你可能感兴趣的文章
    occi库在oracle官网的下载针对vs2008
    查看>>
    OceanBase 安装使用详细说明
    查看>>
    OceanBase详解及如何通过MySQL的lib库进行连接
    查看>>
    ocp最新题库之052新题带答案整理-36题
    查看>>
    OCP题库升级,新版的052考试题及答案整理-18
    查看>>
    OCR:文字识别(最详细教程)
    查看>>
    OCR使用总结
    查看>>
    Octotree Chrome插件离线安装
    查看>>
    OC中关于给NSString 赋 nil和@""的区别
    查看>>
    OC字符串方法汇总
    查看>>
    oday!POC管理和漏洞扫描小工具
    查看>>
    ofbiz 定义
    查看>>
    Ofelia:在Pd中融合openFrameworks与Lua的创意编程利器
    查看>>
    Office online server 部署
    查看>>
    office 中墨迹书写工具_自动生成英文书法稿纸的几个网址,及Briem 的cursive italic书写教程...
    查看>>
    Office2010每次启动都要配置的解决办法
    查看>>
    Office2016 打开excel出现丢失appvisvsubsystems32.dll
    查看>>
    OfficeWeb365 Readfile 任意文件读取漏洞复现
    查看>>
    OfficeWeb365 SaveDraw 文件上传漏洞复现
    查看>>
    office中的所有content type
    查看>>