开发者

Button with image and loading element id when clicked

开发者 https://www.devze.com 2022-12-28 11:06 出处:网络
I\'ve made an application that makes full use of ajax, and what I need to do is: I want a button with a description + image that when clicked is disabled and instead of the original image in the butto

I've made an application that makes full use of ajax, and what I need to do is: I want a button with a description + image that when clicked is disabled and instead of the original image in the button, appears the ajax loading element id inside the button. And when the a开发者_JAVA技巧jax loading is complete, the original image of the button returns to the normal.

Is there any good source on how to do something like this? What do you guys suggest?


if your button is image you can just change it's source like this


function call_my_method(el)
{
  //ajax call and stuff
 el.setAttribute('src', 'loading.gif');
}

and all you have to do is return old image once you get response from server, same way as you put the loading.gif

0

精彩评论

暂无评论...
验证码 换一张
取 消