Now compare the pros and cons of Ajax with hidden form submissions.
1. Hide form submission, update the data after the completion of the need to go to a blank page and then the original page submitted after processing; Ajax is not, you can directly
1,ajax (asynchronouse JavaScript and XML) asynchronous Javascrip and XML
2 (contains 7 techniques: JavaScript XML XSTL dom xhtml css XMLHttpRequest)
3 is a server language-independent technology that can be used in (php/jsp/asp.net)
How 4,ajax
A simple example of Ajax: Selecting a book will get the relevant name in real time via Ajax.
4 HTML files to the same file on the Web site.
index.html
Copy Code code as follows:
a simple Ajax instance that
1:ajax constructs a URL that passes parameters to data and cannot be used for form submission.Cases:
Copy Code code as follows:
function createhtml (ID) {
$ ("#reloading"). Show ();
EDIT_BG is a div, displayed when submitted, so that
Because of internship needs, we need Ajax to get the values in the list set in the background. Since there is no contact before, so today to study the next.
first, you need to download the JSON-dependent jar package. It is mainly dependent on the
Examples are as follows:
Convert form to Ajax commit
function Ajaxsubmit (URL,FRM,FN) {
var datapara=getformjson (frm);
$.ajax ({
url:url,
type: "Post",
Data:datapara,
async:false,
dataType: ' txt ',
Index.html
Copy Code code as follows:
jquery Ajax Example Demo
Enter Name:
input Password:
ajax submit
post submit
get submit
login.php
Copy Code code as follows:
echo json_encode
Recently more idle, the previous use of the technology string to do a codex, convenient after their lazy, birds you happy.
First of all, the JavaScript version of Ajax to make the comments: Ajax asynchronous refresh is mainly the required
Today, to modify a bug, using AJAX query data, Google Browser can get the latest data, and in IE to get the old data, can not get the latest data, after the search data, only to discover when IE cache mischief.
Found this Ajax request using the Get
The Ajax invocation of jquery is convenient, and the data format of JSON is preferred when passing in the parameter. Like what:
Copy Code code as follows:
function AddComment (content) {
var threadId = $ ("#span_thread_id"). html ()
The
key method:sort () to sort the elements of the array.
return a.num-b.num is ascending;
return b.num-a.num; is descending
Writeln in the output after \ n, in the document is a newline, in the HTML is interpreted as a space.
Copy Code code
First, create a public static method in the Aspx.cs file, and then add the WebMethod attribute.
Such as:
[WebMethod]
public static string GetUserName ()
{
//......
}
If you want to manipulate the session in this way, you have to set the WebMethod
When you register a user on any Web site, you will check to see if the user already exists. A long time ago the process was to submit all the data to the server side for verification, obviously the user experience in this way is very bad; then with
jquery does not have to say that you can read the article, you must know that all jquery is the JS framework.
We must use Ajax more or less when we are doing the project.
And if you use jquery ajax, then you need to introduce jquery into the JSP
(Http://www.fckeditor.net, Javaeye's editor is also used fckeditor,xx like-minded?) hehe), it opensource (free Ah, can directly change the source code ah, hehe), powerful (almost a web version of Office Word), provides support for a variety of
First, Webservice.asmx:
Processing business data, generating DataSet (XML) data in the GetDataSet () method for jqueryrequest.aspx calls, as follows:
Copy Code code as follows:
[WebMethod]
Public DataSet GetDataSet ()
{
DataSet
First, Webservice.asmx:
Processing business data, generating the person entity class data in the Getperson method for jqueryrequest.aspx invocation, the code is as follows:
Copy Code code as follows:
[WebMethod]
Public person
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