EasyUI Forum

General Category => General Discussion => Topic started by: azizkhani on May 07, 2015, 11:35:15 AM



Title: how to set $.ajax to async:false in combobox remote
Post by: azizkhani on May 07, 2015, 11:35:15 AM
how to set $.ajax to async:false in combobox remote

$.ajax({
            type: opts.method,
            url: opts.url,
            data: param,
                                async:false, ??? ??? ???
            dataType: 'json',
            success: function(data){
               success(data);
            },
            error: function(){
               error.apply(this, arguments);
            }
         });


Title: Re: how to set $.ajax to async:false in combobox remote
Post by: stworthy on May 07, 2015, 07:26:48 PM
The 'loader' function allows you to define how to load data from remote server, please try the code below:
Code:
$('#cc').combobox({
loader: function(param,success,error){
var opts = $(this).combobox('options');
if (!opts.url) return false;
$.ajax({
type: opts.method,
url: opts.url,
data: param,
async: false,
dataType: 'json',
success: function(data){
success(data);
},
error: function(){
error.apply(this, arguments);
}
});
}
})


Title: Re: how to set $.ajax to async:false in combobox remote
Post by: azizkhani on May 08, 2015, 03:08:39 AM
thanks alot for help me for this question and others.