Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $.each(response, function(index) {
- $('#myID').append('<tr><td onclick="select(this)" >'+ response[index] +'</td></tr>');
- });
- function select(element){
- ...
- }
- function select(element){
- var elem = $(element);
- if(elem.hasClass("active")) { // is ajax call active?
- return false;
- }
- elem.addClass("active"); // set it that it is active
- $.ajax({
- url: "foo"
- })
- .done(function(){})
- .always(function(){
- elem.removeClass("active"); // call is done, so remove active state
- })
- }
- function select(element){
- $(element).prop('disabled', true);
- $.ajax({
- url'url',
- success:function(response){
- $(element).prop('disabled', false);
- }
- });
- }
Add Comment
Please, Sign In to add comment