jQuery(function (){ var i = 2; jQuery("#doctor_list").bind("scroll", function (event) { var obj = document.getElementById("doctor_list"); var flag = document.getElementById('flag').value; if (((obj.scrollHeight - obj.scrollTop) <= 700) && (flag == "1") && ($('add_ajax').value == '1')) { $('add_ajax').value = '0'; add_data(i); i++; } }); }); function add_data(i){ var a_data = document.getElementById("ddata_span"); var flag = document.getElementById('flag').value; if (flag == "1") { a_data.innerHTML = "<table><tr><td><img src='/images/loading.gif' /> </td><td><font size='2'>読み込み中...</font></td><tr/></table>"; new Ajax.Request("/admin/doctor/add_data", { asynchronous: true, evalScripts: true, parameters: 'page=' + i + '&branch=<%=params[:branch]%>&office=<%=params[:office]%>&user=<%=params[:user]%>', }); } };
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/13213.html