前端之家收集整理的这篇文章主要介绍了
异步传输方式加载页面,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
function getmore(obj,transtype,type='')
{
var flag =$(obj).parent().siblings("#flag").val();
var domainsld=$('#domainsld').val();
var domaintld=$('#domaintld').val();
var domainlenstart=$('#domainlenstart').val();
var domainlenend=$('#domainlenend').val();
var domaingroup=$('#domaingroup').val();
var bidpricestart = $('#bidpricestart').val();
var bidpriceend = $('#bidpriceend').val();
var finishtime = $('#finishtime').val();
var registrar=$('#registrar').val();
var sort=$('#sort').val();
var hidenobider=$('#hidenobider').val();
var bidstartone=$('#bidstartone').val();
var sldtypestart=$('#start').val();
var sldtypeend = $('#end').val();
var releasetime = $('#releasetime').val();
var per_page = 0;
if(type == 100)
{
per_page = 5*flag;
}
else
{
if(transtype == 1 || transtype == 2 || transtype == 4)
{
per_page = 20*flag;
}
else
{
per_page = 5*flag;
}
}
var str='ajax=1&domainsld='+domainsld+'&domaintld='+domaintld+'&domainlenstart='+domainlenstart+'&domainlenend='+domainlenend+'&domaingroup='+domaingroup+'&bidpricestart='+bidpricestart+'&bidpriceend='+bidpriceend+'&finishtime='+finishtime+'®istrar='+registrar+'&sort='+sort+'&hidenobider='+hidenobider+'&bidstartone='+bidstartone+'&sldtypestart='+sldtypestart+'&sldtypeend='+sldtypeend+'&releasetime='+releasetime+'&transtype='+transtype+'&type='+type+'&per_page='+per_page+'&page='+flag;
var url='';
if(transtype == 5)
{
url="<?PHP echo 'http://auction.ename.com/auction/inquirylist';?>";
}
else
{
url="<?PHP echo 'http://auction.ename.com/auction/domainlist';?>";
}
$.ajax({
type: "GET",url: url,//提交到一般处理程序请求数据
timeout: 10000,data:str,dataType: "json",success: function(data) {
if(data)
{
var html = '';
for(var k in data['data'])
{
if(data['type'] == 100)
{
html +='<tr>'
+'<td><a href="http://www.ename.com/auction/domain/'+data['data'][k].AuditListId+'" target="_blank">'+data['data'][k].DomainName+'</a></td>'
+'<td><span>'+data['data'][k].BidPrice+'</span>元</td>'
+'<td><span>'+data['data'][k].LeftTime+'</span></td>'
+'</tr>';
}
else
{
if(data['transtype'] == 5)
{
html +='<tr>'
+'<td><a href="http://www.ename.com/auction/domain/'+data['data'][k].AuditListId+'" target="_blank">'+data['data'][k].DomainName+'</a></td>'
+'<td><div class=" class="summary_200" title="'+data['data'][k].SimpleDec+'">'+data['data'][k].SimpleDec+'</div></td>'
+'<td>'+data['data'][k].shoper+'</td>'
+'<td><a href="http://'+data['data'][k].Seller+'.shop.ename.com" target="_blank">'+data['data'][k].Seller+'</a>'
if(data['honor'][data['data'][k].Seller].num)
{
strSeller = '';
for(var kk=0 ;kk < data['honor'][data['data'][k].Seller].num ;kk++)
{
var seller = data['data'][k].Seller;
strSeller += '<img src=http://www.ename.com/static/images/'+data['honor'][seller].img+'>';
}
html += strSeller;
}
html +='</td><td><span>'+data['data'][k].LeftTime+'</span></td>'
+'</tr>';
}
else
{
html +='<tr>'
+'<td><a href="http://www.ename.com/auction/domain/'+data['data'][k].AuditListId+'" target="_blank">'+data['data'][k].DomainName+'</a></td>'
+'<td><div class="summary300" title="'+data['data'][k].SimpleDec+'">'+data['data'][k].SimpleDec+'</div></td>'
+'<td>'+data['data'][k].shoper+'</td>'
+'<td><a href="http://'+data['data'][k].Seller+'.shop.ename.com" target="_blank">'+data['data'][k].Seller+'</a>'
if(data['honor'][data['data'][k].Seller].num)
{
strSeller = '';
for(var kk=0 ;kk < data['honor'][data['data'][k].Seller].num ;kk++)
{
var seller = data['data'][k].Seller;
strSeller += '<img src=http://www.ename.com/static/images/'+data['honor'][seller].img+'>';
}
html += strSeller;
}
html +='<td><span>'+parseInt(data['data'][k].BidPrice)+'</span>元</td>'
+'<td>'+data['data'][k].BidCount+'</td>'
+'<td><span>'+data['data'][k].LeftTime+'</span></td>'
+'</tr>';
}
}
}
$(obj).parent().parent().before(html);
$(obj).parent().siblings("#flag").val(parseInt(flag)+1);
}
}
});
原文链接:https://www.f2er.com/ajax/165746.html