In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly shows you "how to use Javascript to send GET/POST requests", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "how to use Javascript to send GET/POST requests" this article.
GET/POST data submission method based on JQuery
If you are new to Javascript, you may not be as clear about JQuery as I am, so properly popularizing JQuery is a fast, concise JavaScript framework, another excellent JavaScript code base (or JavaScript framework) after Prototype. JQuery is designed to be "write Less,Do More", which advocates writing less code and doing more.
It encapsulates the common functional code of JavaScript, provides a simple JavaScript design pattern, and optimizes HTML document operation, event handling, animation design and Ajax interaction. The core features of JQuery can be summarized as follows: unique chain syntax and short and clear multi-function interface; efficient and flexible css selector, which can be extended to CSS selector; convenient plug-in extension mechanism and rich plug-ins. JQuery is compatible with a variety of mainstream browsers, such as IE 6.0 +, FF 1.5 +, Safari 2.0 +, Opera 9.0 + and so on.
The official website address of JQuery, you can click to visit. According to the official version, the latest version has reached v3.2.1, so it is recommended that you consider downloading the latest JQuery from the official website to get more features.
JQuery is very powerful, but to achieve the current function requires only two simple, API, the complete API documentation can be viewed, in addition, there are learning materials about Javascript on runnoob.com.
The $.get (url, data, callback) parameter describes the url required, specifies that the URLdata you need to request is optional, specifies the data sent to the server with the request, the format is jsoncallback optional, returns the function, the function $.post (url, data, callback) parameter that runs when the request succeeds describes the url required, specifies that the URLdata you need to request is optional, specifies the data sent to the server with the request, the format is jsoncallback optional, and returns the function. The function to run when the request is successful
The way to use it is as follows: first, import the Jquery file with the script tag on the page that needs to call JQuery, for example:
Then, in the blank space of the page, declare your method and the parameters you need to pass, and you can do this:
Function doPost (url) {var val1 = document.getElementsByName ("key1"). Value; var val2 = document.getElementsByName ("key2"). Value; $.post (url, {'key1':val1,' key2':val2});}
Next, add an onclick attribute to your input/button tag or where you need to send data, such as:
...
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.