The get and post methods in Jquery Ajax are not frequently asked.

Source: Internet
Author: User

The get and post methods in Jquery Ajax are not frequently asked.

Today, I encountered a very strange phenomenon. Later I found it was the Ajax get method. After loading it once, I did not access the database, but the post method accessed the database once every time.


Case requirements: When you click the record line in the "Project information list", the "Project Interface Information List" will be loaded together"

$ (# ProjectGrid #). datagrid ({onClickRow: function (rowIndex, rowData) {var url = ROOT_PATH + "/projectInterface/queryProjectInterfaceList. do? Pid = "+ rowData. mdId; $. ajax ({type: "GET", url: url, success: function (result) {console.info (result); var converData =$. parseJSON (result); $ ("# projectInterfaceGrid "). datagrid ("loadData", converData); // load data }})}});
Debug found that the log line was clicked for the first time, and the log of the SQL statement in the background was printed. After clicking the log, N times of the log were not accessed and the log record was printed, however, the success method of Ajax is still executed, which gives me the feeling that the cache is loaded.

When I modify the record data of the "Project Interface Information List" in the database, click the "Project Information List" record line to display the old data, it is inconsistent with the actual data of the database. later it was found that after the GET type is changed to the POST method, the database query operation will be performed again each time the record row is clicked, consistent with the actual data



--


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.