jquery json suggest plugin

jquery json suggest plugin

Hi,

I’m using ajax to retrieve data from server to suggest, and i dont know how to wait until ajax is ready. I’m using jsonp with no synchronous support



var result;
(‘input#input’).jsonSuggest(

function(text, wildCard, caseSensitive, notCharacter) {

var surl = ‘http://myurl;

$.ajax({
cache: false,
url: surl,
dataType: “jsonp”,
jsonp : “callback”,
success: function(data) {
result = data;
}
});







return result;

}, {ajaxResults:true});

Result is returned before ajax is completed so it’s empty
I tried delay() and similar but nothing worked

Thank you for any help. I’m hopeless.