I'm using $ $ to get some data and then store it in cookies. If a user clicks on a button, the request is received, then they will follow the link on another page and the data stored in the cookie is removed and displayed on the new page.
Unfortunately some people are strong with their clicks, get requests but the time to complete before going to the next page is obviously causing an error, I want to disable the link on the next page until the request is received, but I do not know how.
I have it right now.
$ Get (url, function (d) {cp = $ ('textarea # txt_quote', d). Html (); z_cookie.set (topic_id, current_posts, '1');});
You disable the click event handling link In this way:
var link = $ (selector of & lt; a & gt; tag); Link.click (function () {return false;}); $ .get (url, function (d) {cp = $ ('textarea # txt_quote', d) .html (); z_cookie.set (topic_id, current_posts, '1'); link.unbind ('click'); }); If you want, you can define a variable in the click handler, and if it is set, the page after the AJAX request is finished Navigate to, like this:
location.href = link.attr ('href');
Comments
Post a Comment