[eluser]John Murowaniecki[/eluser]
I work a lot with ajax and CI, eventually I get some slow behavior but normally all request/posts are fast (very fast).. But I´ve decided to test, so there´s my controller:
Code:
class ajax extends Controller
{
function async($arg = NULL)
{
die(date('Y-m-d H:m:i s')." $arg");
}
#
}
And those are my js/jquery functions:
Code:
var extc = 0;
//
function func_one()
{
ini = ( date.getMinutes() * 60 ) + date.getSeconds() + date.getMilliseconds();
$.ajax({
url: 'http://yourdomain/yourapplicationfolder/ajax/async/one/'+ini,
success: function(data) {
console.log(data);
if( ++extc < 100 ) func_two();
}
});
end = ( date.getMinutes() * 60 ) + date.getSeconds() + date.getMilliseconds();
console.log((end - ini)+' miliseconds to load data from func_one');
}
//
function func_two()
{
ini = ( date.getMinutes() * 60 ) + date.getSeconds() + date.getMilliseconds();
$.ajax({
url: 'http://yourdomain/yourapplicationfolder/ajax/async/two/'+ini,
success: function(data) {
console.log(data);
if( ++extc < 100 )func_one();
}
});
end = ( date.getMinutes() * 60 ) + date.getSeconds() + date.getMilliseconds();
console.log((end - ini)+' miliseconds to load data from func_two');
}
//
function func_run()
{
extc = 0;
func_one();
}
//
So when I execute the func_run() on the firebug I get a nice result despite I´ve sending almost nothing (and receiving almost nothing). I'm treating this as the "end" of the request the termination of the function (and not the actual return ajax).
Did you check your error log?