The original Jquery.load method can always load down _jquery

Source: Internet
Author: User
As long as there is no conflict (for example, ID cannot), I wrote an example of using page parameters to control the internal element ID and load ourselves on each other. This is a JSP page with the following code:
Copy Code code as follows:

<%@ page language= "java" import= "java.util.*" pageencoding= "UTF-8"%>
<%
String path = Request.getcontextpath ();
String basepath = request.getscheme () + "://"
+ request.getservername () + ":" + request.getserverport ()
+ path + "/";
int i = Integer.parseint (Request.getparameter ("I") ==null? " 0 ": Request.getparameter (" I "));
%>
<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" >
<base href= "<%=basePath%>" >
<title> User Login </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 are my page" >
<script type= "Text/javascript" src= "<%=path%>/scripts/jquery-1.5.1.js" ></script>
<script type= "Text/javascript" >
$ (document). Ready (function () {
$ ("#h <%= I%>"). Click (function () {
$ ("#d <%= I%>"). Load ("<%=basepath%>index.jsp", {i:<%=i+1%>});
});
});
</script>
<body>
This is index.jsp?i=<%= i%>
<input type= "button" value= "get<%= i+1%>" id= "h<%= I%>" >
<br>
<div id= "d<%= i%>" style= "border:1px"; Border-style:solid; margin:5px; " >load index.jsp?i=<%= i+1%> here!</div>
</body>

After running, as shown in the figure, you can always point to:

However, if you only take a part of the page, for example, change the button's click Code to:

Copy Code code as follows:

$ ("#d <%= I%>"). Load ("<%=basepath%>login.action input", {i:<%=i+1%>});

So, the load is just a button, not the entire page. As shown in figure:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.