JQuery Autocomplete Custom Display Multi-column Part 2

前端 未结 1 1101
再見小時候
再見小時候 2021-01-16 18:09

I am trying to get an autocomplete similiar to: Here at jquery ui in their custom example.

This instead will use an ajax call instead of hard-coded data. I have two colu

相关标签:
1条回答
  • 2021-01-16 18:37

    In your $.ajax call, you're not specifying a success callback:

    $.ajax({
        url: 'ajax/jsonencode.php'+querystring,
        beforeSend: function(){
            alert("beforeSend");
        },
        async:    true,
        dataType: "json"
    });
    

    Since the widget expects you to invoke the response function to supply the suggestions, you should do something like this:

    $.ajax({
        url: 'ajax/jsonencode.php'+querystring,
        beforeSend: function(){
            alert("beforeSend");
        },
        async:    true,
        dataType: "json",
        success: response
    });
    

    That assumes your data has at least a label or value property.

    0 讨论(0)
提交回复
热议问题