JQUERY AJAX /自动完成

Hello I am using Laravel 4..
I want to use Jquery Autocomplete,So I have used Code as below:

$("#txtQualityNo").autocomplete({
    dataType: 'json',
    source: availableTags
    minLength: 3,
    dataType: 'json',
    source: '/purchaseorder?autoQualityNo=' + $(this).val() + '&companyMillSelected=' +             $companyMillSelected,
    focus: function (event, ui) {
        //  $( "#project" ).val( ui.item.label );
        return false;
    },
    select: function (event, ui) {
        $("#txtQualityNo").val(ui.item.qualityno);
        $("#txtShadeNo").val(ui.item.shadeno);

        return false;
    }
})
    .data("ui-autocomplete")._renderItem = function (ul, item) {
    return $("<li>")
        .append("<a>" + item.qualityno + "#" + item.shadeno + "</a>")
        .appendTo(ul);
};

In Controller I have used code:

if (Request::ajax() && Input::has('autoQualityNo')) {
    $records = DB::table('blah') - > get(array('qualityno', 'shadeno', 'stockid'));
    return Response::json($records);
}

So it shows Request time as 0ms,waiting time as 1.15 secs and response time as 5 ms
So for autocomplete this time is too much

Does any one have idea regarding this ?

查看全部
weixin_33738982
?Briella
2014/02/10 06:24
  • autocomplete
  • ajax
  • jquery
  • 点赞
  • 收藏
  • 回答
    私信

0个回复