Hi,
has anyone used the autocomplete plugin with JSONP? I need to make a
cross domain call and am able to get the JSONP data, but the
autocompleter seems to just stop after that... I've tried a couple of
things and have posted my latest JS code here and at :
http://jsbin.com/aqefi/edit
I've tried the approach posted here and also tried to create a new $
(...).autocomplete() call in the jsonp callback function (even tried
to destroy the existing autocomplete before re-creating it and feeding
in the json data)
sort of at a loss and maybe it's easy and maybe it's not...
thanks for the help!
Roger
code below:
window.jsonpSearchComplete = function(searchData) {
console.log($('input#search').autocomplete());
jQuery('input#search').autocomplete("setData", { data:
searchData });
};
// get the data via jsonp and feed to a new autocomplete query
$('input#search').autocomplete({
url: 'http://lw-ct-raymondr/work/searchData.txt',
minChars: 3,
cacheLength: 20,
dataType: 'jsonp',
selectFirst: false,
scroll: true,
scrollHeight: 200,
formatItem: formatItem,
formatResult: formatResult
});
$('input#search').autocomplete("result",function(evt,data,formatted) {
console.log(evt,data,formatted);
});
/* searchData.txt
jsonpSearchComplete([{"id":"0","name":"alex boston"},
{"id":"0","name":"boston breakers"},
{"id":"0","name":"boston bruins"},
{"id":"0","name":"boston celtics"},
{"id":"0","name":"boston college eagles"},
{"id":"0","name":"boston mccornell"},
{"id":"0","name":"boston red sox"},
{"id":"0","name":"boston university terriers"},
{"id":"0","name":"boston utd"},
{"id":"0","name":"daryl boston"},
{"id":"0","name":"david boston"},
{"id":"0","name":"donte boston"}]);
*/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jQuery UI" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/jquery-ui?hl=en
-~----------~----~----~----~------~----~------~--~---