There are three kinds of methods I have used:
1 Add a hidden button to the page, define the event, and then execute the $ ("#隐藏btnID") of JS. Click () to perform the background method
2 Use Ajaxpro to perform
3 using the Ajax URL: page
a asp.net AJAX Framework
1, Validatorcallout
ASP.net is a member of the AJAX Control Toolkit, an old bottled new wine that provides a nice pop-up hint for asp.net's validation controls through an extended approach. The disadvantage is that the
Using the jquery framework: Download jquery.js
Create a new Web project Ajax;
Create a new Jslib folder under WebRoot: Specially store JS file;
Create a new html/jsp page under WebRoot:
Login.html
Copy Code code as follows:
This article realizes using jquery Ajax to realize asynchronous access and asynchronous loading, has certain reference value, the interested small partner may refer to.
"Asynchronous Access"
Use an example to illustrate: Click on the button to
Problem:
Before the development of the project encountered a problem, Ajax asynchronous request after the success of the new open window to open the URL, using the window.open () method, but unfortunately by the browser to intercept, how to solve
1, before the AJAX send the request plus Anyajaxobj.setrequestheader ("if-modified-since", "0").
2, in the AJAX send the request before adding Anyajaxobj.setrequestheader ("Cache-control", "No-cache").
3, after the URL plus a random number: "Fresh=
This example uses jquery.form.js, please go to the demo page to view
CSS Code
Copy Code code as follows:
Xml/html Code
Copy Code code as follows:
0%
JavaScript Code
Here, suppose the reader understands the basic
Ajax
Technology or more. I'm just explaining a phenomenon, a solution, a reason,
Principle, equally not clear
......
Let's start with a simple start,
Servlet passes value to JSP page JS
Script,
Copy Code code as follows:
var xmlhttp = null;
function Myajax () {
1. Create XMLHttpRequest Objects
2, the need for IE and other browsers to create this object different ways to write different code
if (window. XMLHttpRequest) {
For
Copy Code code as follows:
function Creatajax () {
var ajax=null;
if (window. XMLHttpRequest) {
Create XMLHttpRequest objects for browsers such as Mozilla, Netscape, and Safari
Ajax = new XMLHttpRequest ();
if (Ajax.overridemimetype) {
If
I will launch the AJAX original series tutorial in the Web circle, if you don't know what Ajax is, please read: What is AJAX?
Before this we need to do a simple AJAX preparation, but you have to have the basic html,javascript,dom writing ability.
Creates a XMLHttpRequest object.
Copy Code code as follows:
return window. ActiveXObject? New window. ActiveXObject (' Microsoft.XMLHTTP '): New XMLHttpRequest;
A onreadystatechange event for the secondary object. There are two
Copy Code code as follows:
-----------------------------htmlpage1.htm---------------------------------
First page Prev next page Last page Id= "Txtpageindex" type= "text"/>Go
-------------------------WebService1---
Scrolling down to the bottom of the page load data is a lot of waterfall streaming site practice, that to see how to achieve with JSONP, side dishes summary record, the master do not spray.
Of course, this example uses the jquery library, the
Page Script:
Copy Code code as follows:
function Ajaxsave (URLS) {
Defines a variable for storing XMLHttpRequest objects
var xmlhttp;
Defines a variable for storing the response returned from the server
var responsecontext = "
IE7 and the following request method with Get, the URL limit is a very easy to ignore the problem (maximum 2,083 characters). So if the URL is likely to be too long, be sure to use post.
---------------------------------------------------------------
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.