Ver Mensaje Individual
  #1 (permalink)  
Antiguo 29/06/2013, 18:31
Avatar de randy05
randy05
 
Fecha de Ingreso: agosto-2012
Mensajes: 37
Antigüedad: 11 años, 7 meses
Puntos: 1
Funcion ajax redirecionar a pagina

Hola compañeros.

estoy trabajando en una aplicacion el cual tengo esta funcion ajax en el index

este troso de codigo va en el head

Código:
<script>
 function AjaxResponse()
 {
	 var myData = 'connect=1'; //For demo, we will pass a post variable, Check process_facebook.php
	 jQuery.ajax({
	 type: "POST",
	 url: "login.php",
	 dataType:"html",
	 data:myData,
	 success:function(response){
      $("#results").html(''+response+''); //Result

 },
	 error:function (xhr, ajaxOptions, thrownError){
	 $("#results").html(''+thrownError+''); //Error
 	}
 });
 }
 
function LodingAnimate() //Show loading Image
{
	$("#LoginButton").hide(); //hide login button once user authorize the application
	$("#results").html('<img src="ajax-loader.gif" /> Please Wait Connecting...'); //show loading image while we process user
	
}

function ResetAnimate() //Reset User button
{
	$("#LoginButton").show(); //Show login button 
	$("#results").html(''); //reset element html
}

 </script>
Y este en body

Código:
<div id="fb-root"></div>
<script type="text/javascript">
window.fbAsyncInit = function() {
FB.init({appId: '<?php echo $appId; ?>',cookie: true,xfbml: true,channelUrl: '<?php echo $return_url; ?>channel.php',oauth: true});};
(function() {var e = document.createElement('script');
e.async = true;e.src = document.location.protocol +'//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);}());

function CallAfterLogin(){
		FB.login(function(response) {		
		if (response.status === "connected") 
		{
			LodingAnimate(); //Animate login
			FB.api('/me', function(data) {
			  if(data.email == null)
			  {
					//Facbeook user email is empty, you can check something like this.
					alert("You must allow us to access your email id!"); 
					ResetAnimate();

			  }else{
					AjaxResponse();
			  }
		  });
		 }
	});
}

</script>
esta funcion va ha este archivo login.php hace las comproaciones y me muestra los datos otenidos, y lo hace dentro de un div en el index, bien esto funciona bien, he aqui mi problema.

estoy intentando que cuando el me muestre los datos me redirecione a otra pagina e intente en el archivo login.php poner un header ("Location: pagina.php" ); y redireciona pero en el mismo div, es decir que me esta redirecionando pero hay mismo y yo lo que deseo es que me cargue la nueva pagina a la que lo estoy mando en el redirecionamiento.

espero haverme dado ha entender..