码迷,mamicode.com
首页 > Web开发 > 详细

ajax

时间:2018-05-30 13:56:26      阅读:221      评论:0      收藏:0      [点我收藏+]

标签:end   esc   info   $.ajax   highlight   duration   nim   val   on()   

$.ajax({
				type : ‘POST‘,
				url  : ‘/plus/list.php‘,
				data : {
					‘pageNum‘	: page -1,
					‘act‘ 		: ‘ajax_page‘,
					‘tid‘		: ‘9‘
				},
				dataType : ‘json‘,
				beforeSend : function(){
					$(".more").html("加载中...");
				},

				success:function(data){
					console.log(data)
					total 		= data.total; //总记录数  
					pageSize 	= data.pageSize;//每页显示条数  
					curPage 	= page;//当前页  
					totalPage 	= data.totalPage;//总页数
					var html = "";
					var list = data.list;
					if(!list) {
						$(".more").html("未添加数据~~~");
						return ‘‘;
					}

					$.each(list, function(key,val){
						var num = page*key + 1 ;
						num = num * 0.2; 

						html += ‘<li class="wow fadeInUp animated" data-wow-delay="‘+num+‘s" data-wow-duration="500ms">‘;
							html += ‘<a href="‘+val.arcurl+‘">‘;
								html += ‘<div class="new_infor_img">‘;
									html += ‘<img class="scales" src="‘+val.litpic+‘">‘; 
								html += ‘</div>‘;

								html += ‘<p class="new_infor_classify">‘+val.source+‘</p>‘;
								html += ‘<p class="new_infor_title">‘+val.title+‘</p>‘;
								html += ‘<p class="new_infor_details">‘+val.description+‘</p>‘;

							html += ‘</a>‘;
						html += ‘</li>‘;
					});

					$(".list_uld ").append(html);  
					$(".more").html("点击查看更多");
					isbool=true;    
					//如果是最后页 
					if( curPage >= totalPage ){  
						$(".more").html("已经没有数据了");
						$(".more").attr("page", ‘0‘)
					} 
					else
					{
						var next = parseInt($(".more").attr("page")) + 1;
						$(".more").attr("page", next);
					} 
				},

			});
		}

  

ajax

标签:end   esc   info   $.ajax   highlight   duration   nim   val   on()   

原文地址:https://www.cnblogs.com/Abner3721/p/9110414.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!