开发者

What is the fastest way of replacing DOM element(jQuery)?

开发者 https://www.devze.com 2022-12-19 05:48 出处:网络
My application 开发者_如何转开发is a real-time apps using ajax environment. It is a live picking of schedule. The users want see the available slot in real-time way. such that they can see other ticki

My application 开发者_如何转开发is a real-time apps using ajax environment. It is a live picking of schedule. The users want see the available slot in real-time way. such that they can see other ticking schedule. And i'm using ajax to replace the element with the new one. Example:

$.get(my_url, function(data){  $('#area').innerHTML(data); });

On success the element with an ID 'area' will be replaced with the new generated html response so that it looks 'real-time'.


Use the load() function

$('#area').load(my_url);


Not sure what you mean by fastest, but the easiest is this:

$('#area').load(my_url);

Which does the same thing your $.get request does.

0

精彩评论

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