Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

Unable to disable “ajaxEnabled” on jQuery Mobile without breaking the JS (Cannot set property 'ajaxEnabled' of undefined) #8572

Open
GWSSS opened this issue May 10, 2017 · 3 comments

Comments

@GWSSS
Copy link

GWSSS commented May 10, 2017

I'm using jQuery Mobile just for the touch/swipe events and don't actually need the AJAX loading. In order to disable it I'm doing the following:

  1. Loading jQuery (v1.12.4)
  2. Loading disable.ajax.js (see below)
  3. Loading jQuery Mobile (v1.4.5)

disable.ajax.js contents:

jQuery(document).bind('mobileinit', function($){
    $.mobile.ajaxEnabled = false;
});

As far as I understood I need to bind this function before loading the JQM. However, this drops an error that is somehow ignored by FF and Chrome, but breaks the JS in Safari.

Any ideas?

@smaiLee
Copy link

smaiLee commented May 11, 2017

You should not pass $ as parameter of your handler function.
The first parameter is the event object, so you overwrite the $ of jQuery by event object.

@GWSSS
Copy link
Author

GWSSS commented May 11, 2017

If remove the parameter and I change it to jQuery.mobile.ajaxEnabled = false; , then it doesn't throw an error, but it simply doesn't work. I still have the ajax on.

@GWSSS GWSSS closed this as completed May 11, 2017
@GWSSS GWSSS reopened this May 11, 2017
@smaiLee
Copy link

smaiLee commented May 11, 2017

Why do you need jQuery, isn't $ defined in your environment? Do you use noConflict()?
I think 1.4.5 won't work with noConflict() as #126 and #346 where fixed in JQM 1.5.0-alpha.

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

No branches or pull requests

2 participants