Welcome Guest, Not a member yet? Register   Sign In
ajax redirec url
#1

[eluser]Unknown[/eluser]
hi,

im a newbie in codeigniter and ajax. i have an ajax just like this

[removed]
function repeatloop()
{
<?php if($this->session->userdata('ex'){ ?>
ajaxFunction();
setTimeout("repeatloop()", 1500);
<?php }else{$_POST['title']='';header("Location: " . $_SERVER['php_SELF']); } ?>
}

function ajaxFunction()
{
var xmlHttp;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
// Internet Explorer
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{
alert("Your browser does not support AJAX!");
return false;
}
}
}
xmlHttp.onreadystatechange=function()
{
if(xmlHttp.readyState==4)
{
document.getElementById("msgstatus")[removed]=xmlHttp.responseText;
}
}
xmlHttp.open("GET","controller/function",true);
xmlHttp.send(null);
}

window.onload=function() {
repeatloop();
}
<div id="msgstatus"></div>

my problem is in the function ,if the record is found i want to redirect to another url.

if i will place just like this redirect('controller/function2') the divs was only changing not the url address at the top.

can someone help me. how to do it




Theme © iAndrew 2016 - Forum software by © MyBB