Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

Clemes

Paginação Ajax

Recommended Posts

Seguinte Gelera, queria saber como faria para usar este código no modo GET e normal , atualmente só consigo usar em uma função ou na outra.

 

O código não é de minha autoria , não sei quase de sobre o mesmo , e estou pedindo a ajuda de vocês é acho que o site com a paginação em ajax fica mais atraente.

<script>
	function ajaxInit(){
		var xmlhttp;
		try{ xmlhttp = new XMLHttpRequest(); }
		catch(ee) {
			try{ xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); }
			catch(e) {
				try{ xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); }
				catch(E){ xmlhttp = false ;	}


			}
		}
		return xmlhttp;
	}

	function carregar(pagina, local){
		
		$(local).html('<img src="img/loading.gif"  class="gif_load" width="126" height="22" />');
		ajax = ajaxInit();
		if(ajax){
			ajax.open('POST', 'geral_ver.php?ID=',  true);
			ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
			ajax.onreadystatechange = function(){
				if(ajax.readyState == 4){
					$(local).html('<img src="img/loading.gif" class="gif_load" width="126" height="22" />');
					if(ajax.status == 200){ $(local).html(ajax.responseText); }
				}
			}
			ajax.send('pg='+pagina);
		}
	}

	$(document).ready(function(){
		$('a.link-ajax').click(function(e){ carregar(this.id, '#ajax_div'); });
		
	});
	
</script>

Compartilhar este post


Link para o post
Compartilhar em outros sites

melhor usar logo jQuery em tudo..

$.get("......", function(data){
....
});

Documentação:

http://api.jquery.com/jquery.get/

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.