-
There are many ways to do this.
Directly change the button to gray, when the request responds, enable this button in the ** of the response to the session["ajax_guid"Put a random GUID value, when the page loads, put it in the hidden domain of the page, and send this GUID value to the server when making an AJAX request, and on the server side, you need to add a filter to determine whether it is an AJAX request (this step is necessary as the case requires), and then determine the GUID and session of the request"ajax_guid"] is consistent. Immediately after the judgment, a new guid is generated and placed in the session["ajax_guid"] (this step can be used as needed, generally as long as the verification is successful, the new guid will not be generated, and the verification will not be regenerated). This is a good way to prevent duplicate submissions, but there are other things you can think of.
Limit the request interval, again, make a record of the session, record the time of the request, and determine whether the time interval between the two requests meets your expected requirements when the next request comes.
All kinds of things and so on, and then think of other ways as needed.
-
1. Problem solving.
There are two ways to solve this problem:
1.When multiple requests are made consecutively, and the URL address of the request is the same. Discard all previous requests and execute only the last request.
2.When multiple requests are made consecutively, and the URL address of the request is the same. Discard all subsequent requests and execute only the first request.
Second, the solution.
1. Set the async of the ajax request to false
ajax (async type: boolean.)
Default value: true. By default, all requests are asynchronous. If you need to send a sync request, set this option to false.
Note that sync requests will lock the browser, and other actions will have to wait for the request to complete before they can be executed.
2. Use jQuery AjaxPrefilter to interrupt the request.
Since the first plan is only a way to save the country from a curve, it actually fails to solve the above problems. Therefore, it is recommended to use this method.
var pendingrequests =
ajaxprefilter(function( options, originaloptions, jqxhr ) else
var complete = ;
function(jqxhr, textstatus)
prefilters are a prefilter that is sent before each request and $ajax() to handle them pre-processing.
options is the option requested.
OriginalOptions value as an unmodified option provided to the AJAX method, therefore, there is no default value in the AJAXCorptions setting.
jqxhr is the requested jqxhr object.
The core idea of the above is to maintain a queue, when a request is sent, the request is queued, and when the request is responded, it is cleared from the queue, which ensures that only one of the same request can be sent at any one time.
Limitations: Just the foreground prevents jquery from ajax requests. For non-jQuery ajax requests, it doesn't work.
Because it uses the jQuery ajaxprefilter function, it only works for jquery ajax requests.
After calling abort, jquery will execute the error method and throw an abort exception message. You can distinguish this type of exception in the following ways.
Eat more lists and fire-fighting foods.
Don't submit more than one manuscript. Many contributors want to review multiple magazines at the same time, and there is always one that can be passed. It is taboo in the academic community to publish multiple manuscripts, please do not violate academic norms. >>>More
To prevent the ** and metastasis of the tumor, NK immunity can be tried**.
If something happens to a person, it's a personal problem; >>>More
It is difficult to completely remove glioma stem cells from surgery, so it will be easy**. In other words, it is difficult to avoid, and how to prevent it is the key to glioma, and it is the core of glioma. Unless you use bio-knife technology to remove them, it seems to be extracting the characteristics of the stem cells of the tumor and then providing them to the "defense cells" in the body that can kill the tumor cells, so that they can recognize the bad cells and destroy them. >>>More