Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MagicSuggest loading image

This is a great plugin indeed, but i'm afraid it doesn't support a loading image for ajax requests yet. I tried to bind it using an "ajaxSend" event with no luck. I tried:

<div id="loading"><img src="loading.gif"/></div> 
ms1 = $('#ms1').magicSuggest({
                        data: ajaxJsonUrl,
                        sortOrder: 'text',
                        valueField: 'text',
                        displayField: 'text',
                        maxDropHeight: 200});

$('#ms1').bind("ajaxSend", function(){
                $("#loading").show();
            });

Is there any way to do this that I have not noticed?

like image 513
tblancog Avatar asked May 26 '26 17:05

tblancog


1 Answers

You can solve this by using the beforeload and load events:

$(ms).on('beforeload', function(){
... // add your gif loader here
});

$(ms).on('load', function(){
... // remove loader
});
like image 116
koni Avatar answered May 30 '26 20:05

koni



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!