ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

EE with Jquery Mobile link/ajax

February 09, 2012 8:50am

Subscribe [5]
  • #1 / Feb 09, 2012 8:50am

    jasonathopi

    35 posts

    I’m trying to get my EE site working with JQM. I’ve found lots of places where people say they are doing it but no one seems to answer how they get the links working with ajx inside of JQM. JQM requires a “hashtag” to links in the same folder.

    I’ve created a template group “mobile”. My link is taking me to a bad url though.

    My link looks like this

    <a href="http://mobile/another_test">Test Button</a>

    and it takes me to

    <a href="http://domain.com/currentpage/#mobile/another_test">http://domain.com/currentpage/#mobile/another_test</a>


    Any idea how to get this working. Anyone who has a successful EE JQM site care to show me how you got the links working with AJAX?


    Here is a link if you want to look at what it’s doing. Just hit the “test button” text at the bottom.
    http://thechallengecup.org/test/

    Thanks for the help,
    Jason

  • #2 / Feb 09, 2012 2:30pm

    Matt Weinberg

    489 posts

    Hi Jason,

    My understanding of jQuery Mobile is that you still would make your content exist at mobile/another_test, marked up in the way jQuery Mobile prefers, and jQuery will just grab it via AJAX and insert the relevant content as necessary. While it’s modifying the hashtag, you shouldn’t need to worry about that as long as your content properly lives in mobile/another_test.

    Does that help?

    -Matt

  • #3 / Feb 09, 2012 2:34pm

    jasonathopi

    35 posts

    Thanks for the reply. I’m gonna play around with it a little bit more. I think my JQM structure is wrong.  I’ll let you know.

  • #4 / Feb 10, 2012 1:09pm

    Shane Eckert

    7174 posts

    Hello jasonathopi,

    Thank you for using the ExpressionEngine forums!

    I am going to move this thread to the Community forum.

    Cheers,

  • #5 / Feb 11, 2012 11:57am

    pixelbaker

    17 posts

    You can disable Ajax links one by one by adding attribute to each link: data-ajax=“false”. There will be no Ajax and no Hash tag then.

    However, finally you will need to disable all of the Ajax in jQmobile because all normal things will not work under Ajax, such as third party Ad, Analytic code etc. After all jQuery mobile is built for app in their main purpose.

    To disable all Ajax, add such code between jQuery JS and jQuery mobile JS:
    [removed]
    $(document).bind(“mobileinit”, function(){
    $.mobile.ajaxEnabled = false;
    });
    [removed] 

    There will be no more “loading…” on your site. Not so nice as before but this is how web page acts.

  • #6 / Feb 11, 2012 11:58am

    pixelbaker

    17 posts

    Oh, [removed] = script tags

  • #7 / Feb 13, 2012 11:13pm

    Try this

    <a href="http://mobile/another_test" rel="external">Test Button</a>
.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases