Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$(...).loading is not a function #12

Closed
phambinh217 opened this issue Dec 28, 2016 · 7 comments
Closed

$(...).loading is not a function #12

phambinh217 opened this issue Dec 28, 2016 · 7 comments
Milestone

Comments

@phambinh217
Copy link

$('*[ajax-form-container]').fajax({
	beforeSend: function() {
		$('body').loading();
	},
    success: function(){
        toastr.info('The form was successfully sent');
        $('body').loading('stop');
    },
});

it error $(...).loading is not a function when i submit form!

@CarlosBonetti
Copy link
Owner

Hi @phambinh217.

Please make sure you're including the dist/jquery.loading.js file in your page.

@Xeobass
Copy link

Xeobass commented Jan 19, 2017

Hi !
I've tryed to use your lib too and i have the same error.

<div id="test" style="width:200px; height:200px;">
testing...
</div>

$("#test").loading();

i use jquery v 1.12.4

i've loaded the jquery.loading.js and jquery.loading.min.js from the dist folder.

=)

@CarlosBonetti
Copy link
Owner

Hi @Xeobass !

Please load just one of the dist/jquery.loading.js OR dist/jquery.loading.min.js, but not both. The min file is identical to the other one, but minified for production.

Also, load the css file if you're not already doing so.

Another thing to consider is the order you're importing and calling the plugin: you need to first import the plugin and just then call the $().loading function. If you're calling the plugin before import you'll get a Uncaught TypeError: $(...).loading is not a function error.

@qiulin
Copy link

qiulin commented Apr 24, 2017

I had same problem. A overlay was attached to ajax request. It works well when request start, but could not stop when ajax request stopped, and caught the error message.

codes likes

$.Loading.setDefaults({
    zIndex: 9999
})

// ajax加载动画
$(document).ajaxSend(function () {
    $('body').loading({overlay: $('#loading-overlay')})
})

$(document).ajaxStop(function () {

    $('body').loading('stop');
})

@CarlosBonetti
Copy link
Owner

Hi @qiulin ! Could not reproduce here... please share the full code with your html script imports. You could use something like codepen.io for that

@ziedmahdi
Copy link

when plugin is imported using npm (Meteorjs application), I get the same error.

@CarlosBonetti CarlosBonetti added this to the 1.3.0 milestone Dec 8, 2017
@CarlosBonetti
Copy link
Owner

It was a bad definition of the UMD exporter. Should be fixed at v1.3.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants