xdan / autocomplete

jQuery autocomplete plugin like Google autocomplete
MIT License
256 stars 92 forks source link

Remote Data not working #11

Open theoremanand opened 9 years ago

theoremanand commented 9 years ago

Hey There,

My PHP is outputting the JSON data as below. But I dont see it working. Can you help me resolving this please...

[{"title":"Caterers"},{"title":"Decorators"},{"title":"Venue"},{"title":"Invitations"},{"title":"Photographers"},{"title":"Entertainment"},{"title":"Wedding Apparel"},{"title":"Travel"},{"title":"Accomodation"},{"title":"Event Planners"},{"title":"Beauty"},{"title":"Gifting"},{"title":"Jewellery"},{"title":"Nitty Gritty"}]

$('#remote_input').autocomplete({ valueKey:'title', minLength: 2, visibleLimit: 5, source:[{ url:"test.php?s=%QUERY%", type:'remote', getValueFromItem:function(item){ return item.title }, ajax:{ dataType : 'jsonp'
} }]});

xdan commented 9 years ago

jsonp - it's not JSON it must be functionname({json});