Let's take a look at an AJAX example
Copy Code code as follows:
Content of test.jsp:
Copy Code code as follows:
Let's look at the Ajax in jquery
1.load ()
The load () method is the
Load syntax
$ (". Selector"). Load ("url", function (ResponseText, statustext, XMLHttpRequest));
Can do to load a page, if there is an error, according to the state given by StatusText, show the corresponding prompts, this is very important to
A common effect, when using AJAX requests, is not to return before the occurrence of a rotating loading small icon or "content loading ..." to inform the user is requesting data. This can be achieved using the Beforesend method.
Download Demo:ajax
This example summarizes the common ways in which jquery invokes Ajax requests. Share to everyone for your reference. Specifically as follows:
Example code 1
$.ajax ('/route ', {
type: ' Get '
data: {param1: ' Hello ', param2: ' The World '
For the XXX platform to implement a feature, use the check box settings on the Announcements pop-up page to no longer notify such announcements. Principle: ,checkbox the form is selected, the Struts2 action Isselect is ' 10 ', and no submit form
jquery is very well encapsulated in asynchronous submissions and is very cumbersome to use Ajax directly, and jquery simplifies our operations without considering the differences in browsers.
$.post, $.get is a simple method, if you want to deal
Preface: This is the introduction of the use of Ajax and background data exchange of small examples, so the demo must be opened through the server. Server environment is very good to build, download Wamp or xampp from the Internet, the installation
When you use "get", the page that you crawl finally adds the encoding type
Copy Code code as follows:
Server side: Servletactioncontext.getresponse (). setcharacterencoding ("Utf-8");
Client page Special effects p/jsp.html
Today encountered a very strange problem, with a variety of tools to check can see the server side returned 200, the data is normal, but $.ajax always into the success, depressed Ah, looking on the Internet,
FAQ scenario:
1. Cross-domain;2. $.ajax
Since JavaScript has a variety of frameworks, such as jquery, using Ajax has become quite simple. But sometimes in order to pursue simplicity, it is possible that the project does not need to load jquery such a large JS plug-in. But what about the
Recently tried to make a department and personnel of the Drop-down box linkage function, department and personnel of the corresponding relationship is 1:n
Copy Code code as follows:
Department
Please select
">
The example in this article describes how Ajax+jquery implements cascading display addresses. Share to everyone for your reference. The implementation method is as follows:
initialization hello display Administrator information
Yesterday someone proposed a bug, said "B + Detective" and "Detective c+" can not see, I was very depressed, because other resources can be played, why this can not play, and the name of the movie I have been converted, in constant debugging, found
Copy Code code as follows:
/**
* Ajax Paging function
* Add
* As a paging component container element.
* PageCount Total Pages
* CurrentPage Current Page
* Container an OL container element with pagination class
* LoadData functions
The example in this article describes jquery's approach to canceling AJAX requests. Share to everyone for your reference. The specific analysis is as follows:
It should be noted here that the AJAX request can be canceled before the response is
Copy Code code as follows:
Synchronous transfer Mode
function Requestbyget (nproducttemp,ncountrytemp)
{
var xmlhttp
if (window. XMLHttpRequest)
{
Isie = false;
XMLHTTP = new XMLHttpRequest ();
}
else if (window. ActiveXObject)
{
Scenario Description:For a login page, there is a login form, but because the login verification logic is more complex, we would like to click the login does not refresh the current page, give the login results and then choose whether to jump to the
After a while, the program uses the jquery load method to request, and it's strange why the request cannot be sent for the second time. Baidu A, who knows the load is to use get way to request, so IE browser to
It is cached. Online Search a lot of
This method is based on the IFRAME implementation, the requirement is the form form submission with file upload input tag, so can not use Ajax to submit
First of all:
Copy Code code as follows:
... ...
The property value at
This article is a journey that I don't know what Ajax is to skillfully use Ajax.
One, the most primitive way to use Ajax
Copy Code code as follows:
Personal Analysis: This method is very good, simple and flexible, but a little
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