2 Votes Vote

jquery autocomplete doesn't work?

Posted by topdog 283 days ago Questions| doesn work autocomplete All

I want to make autocomlplete for remote data source, I get all data from database and return it as jSon, using console I see that all data has been returned, but the autocomplete doesn't work, also the alert in my code doesn't work, here's my code

$("#cellPhoneNo").autocomplete({

    source: function(request, response) {
        var param = {
            "action": "getCellPhoneNos"
        };
        $.getJSON("controllers/Customer.controller.php", param, function(result) {
            alert('here'); //doesn't alert
            //  cellPhoneSource=result;
        });
    },
    select: function(event, ui) {
        alert('response');
    }

});

EDIT

I try to get the source using GET , I make like this

source:function(request,response){
            var param= {"action":"getCellPhoneNos"};
            $.ajax({
            type: "GET",
            url: "controllers/Customer.controller.php",
            data: param,
            success: function(result){
            alert('success');
            }

            });
            },

it alerts but autocomplete doesn't work, I try to put the values in a text file and make the file in the url , the autocomplete works!!

Any explanation?!

Originally asked by: Alaa on Stack Overflow

Discuss Bury


Who Voted for this Question