0

I use jQM in my Wordress site, raigle.net. I need to disable AJAX. How can I do that, knowing that jQM is loaded in functions.php?

This is my code to integrate jQM:

function custom_theme_files() {
    wp_enqueue_script( 'jquery' );
}


/* Incorporating jQuery Mobile */
function get_jqm() {


wp_enqueue_script(
 'jqm_js',
 'http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js',
 array('jquery'),
 '1.3.2'
 );

wp_register_style(
 'jqm_css',
 'http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css',
 '',
 '1.3.2'
 );
wp_enqueue_style(
 'jqm_css',
 'http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css',
 '',
 '1.3.2'
 );
 }
 add_action('wp_enqueue_scripts', 'get_jqm');

I know, that somehow I should include this raw HTML before (from here):

<script type="text/javascript">
$(document).bind("mobileinit", function () {
    $.mobile.ajaxEnabled = false;
});
</script>

How can I do that in Wordpress style?

Community
  • 1
  • 1
artildo
  • 79
  • 8

1 Answers1

0

You need to insert the mobileinit event after jquery and before jquery mobile. See this post for explanation: How To Disable Ajax In jQuery Mobile Before Page Load?

Also, best practice is to put your CSS files before your Javascript files.

Lastly, Wordpress already has jquery mobile ready to be called. Simply add: wp_register_script( 'jquery.mobile' );

Community
  • 1
  • 1