Using Ajax to display top 5 links from another page

$ = jQuery;
$('#button-ajax').click( function(){
	$.ajax({
		url: '/archives/adding-twitter-site', 
		success: function(result){
			var anchors = $(result).find('a'), links = '', i;
			var linkTable = $('<ul></ul>');
			for ( i=0; i<5; i++ ){
				var li = $('<li></li>').html(anchors[i]);
				linkTable.append(li);
			};	
			$('.pf-content').append(linkTable);
		}
	});
})

Print Friendly

Leave a Reply

Your email address will not be published. Required fields are marked *



*