Is form the only source of data submitted by the user? How to solve

Source: Internet
Author: User
Is form the only source of data submitted by the user? We can use form to upload files, input values, and url-based values are submitted through form. is form the only source of data submitted by users? ------ Solution ------------------ simply put, the XMLHttpRequestXMLHttpRequest object provides full access to the HTTP protocol, including POST and form. Is it the only source of data submitted by the user?
We can use form to upload files, input values, and url-based values are submitted through form. is form the only source of data submitted by users?

------ Solution --------------------
Simply use XMLHttpRequest

The XMLHttpRequest object provides full access to the HTTP protocol, including the ability to make POST and HEAD requests and common GET requests.
------ Solution --------------------
If ajax is used, no form is required. Values can be passed without tags.
For example, jquery. ajax:

Click



$ ('P'). click (function (){
Var value = values (this).html (); // for example, pass

Tag HTML content: click to go to the somelink. php page.
$. Ajax ({
Url: "somelink. php", // "somelink. php? Name = "+ value,
Type: 'post', // 'GET ',
Data: "name =" + value, // POST requires data, get just writes the value into the URL
Success: function (data ){
// Console. log (); print the transfer information.
}
});
------ Solution --------------------
Http is an interactive format... it is a text protocol based on TCP/IP...
That is to say, for servers that follow the HTTP standard, you can tell them the request content using the same HTTP standard protocol ..

The most common client is the browser, and the most common request methods in the browser are form submission and GET requests...
In fact, all parts of the HTTP request are submitted to the server, such as the query string, HOST name, request method, request body, and so on ..

The form you mentioned here generally regards it as the request body data submitted by the POST method. it is the most common and most common way to submit various data in the browser, but it is not the only one.
------ Solution --------------------
You can also use soket to simulate post.

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.