Welcome Guest, Not a member yet? Register   Sign In
$.post from the view to controller SLOW
#1

[eluser]Unknown[/eluser]
Hello,

I'm building an autosuggest for a field. So from the view on the keyUp event of a field a call that
Code:
$.post('index.php/ajax/autosuggest',
                { 'str':str },
                function(result) {
                    // if there is a result, fill the list div, fade it in
                    // then remove the loading animation
                    if(result) {
                        $('#autosuggest_list').html(result);
                        $('#autosuggest_list').fadeIn(500);
                    //    $('#class_activity').removeClass('loading');
                }
            });

In my controller the autosuggest method return me a simple string (just to test). when i run it on localhost. it's very fast. But when i put in on my webserver (OVH, 60 euro per month) the $.post call taks... 6 secondes !! (every times)

Can someone tell me what's wrong ? The way i'm implementing it is the server that has a problem ??

thanks
#2

[eluser]Mike DeFelice[/eluser]
The field in the database can you make it an index? If there are many records that may be the problem.
#3

[eluser]Unknown[/eluser]
I thought it was the database but that is why (as i said in the thread) i just return a simple string : "echo '<div>hello</div>'

and it's still slow, so the problem is not the database...
#4

[eluser]InsiteFX[/eluser]
Try using CI's Profiler or benchmark to see where your bottle neck is.

InsiteFX




Theme © iAndrew 2016 - Forum software by © MyBB