In writing this demo, originally wanted to directly access the side of the blog RSS, but this is obvious cross-domain access, is not allowed.
Therefore, the side dishes of the blog RSS saved to the local, is an XML format file, directly with Ajax
Ajax is very difficult to say, but the encapsulation you will find that it is easy to use, of course, is also a simple application, such as the application of the message board, here, first of all, to send everyone a gift that is encapsulated good
This feature has been in the trial for a week, there is no problem, strange that there is a problem today??
Copy Code code as follows:
Ajaxrequestobj.createeqstatusparameter=function () {
if (Eqstatusarray.length Return
}
var
Realize:
With the above two sentences, each named text box will have five more attributes:
1.action must be. Accepts data submitted by Get method and returns a dynamic page of related Javascript arrays.
2.capture if more than one column of results
If we use AJAX technology to do the above, we don't have to wait for the server to return information. When a user enters a user name or enterprise name, when the input text box loses focus, the request is automatically made to the server, and the
Here's my program.
Html:
Copy Code code as follows:
Untitled Page
Please enter your name:
REQUEST.ASHX:
Code
Copy Code code as follows:
Using System;
Using System.Web;
public
Verify from the Username user table in the database my:
Checkusername.html:
Copy Code code as follows:
Untitled Document
Name:
check_it.php:
Copy Code code as follows:
$username
First, add a ScriptManager control to the page.
Second, the registration namespace:
Type.registerNamespace ("Demo");
Add constructors, properties, methods to the class.
Demo.sample=function () {}
Iv. Registration
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:
Small try Ajax, feel more concise than prototype, in jquery, Ajax has three ways to implement: $.ajax (), $.post,$.get ().
XHTML (Main):
Enter Name:
input Age:
Enter Gender:
input work:
Submit
post submit
get submit
Js:
1, the
Function implementation:
Fill in the text box content in the JSP page, the cursor leaves the text box, in the corresponding place of this page obtains the other data which the database changes the value corresponding.
Servlet:
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=
1:
JSON (Javascriptobject notation) is a simple data format that is lighter than XML. JSON is the native format of JavaScript, which means that processing JSON data in JavaScript does not require any special APIs or toolkits.The rule of JSON is
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
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