• Resolved bogdan747

    (@bogdan747)


    Hi
    I have written a Menu Bar for a customer. It works using AJAX/PHP to get the data for the menu from central location into the affiliated websites.

    Mostly works OK, but I have a last hurdle to pass before I can finalize. It does not show at all in IE (6 and 9) while using the wordpress structure. Every page works OK in FireFox and displays static html page in IE but nothing under the wordpress structure.
    Can anyone help?

    FireFox http://seetasmaniapass.iventurecard.com/ – OK
    FireFox http://seetasmaniapass.iventurecard.com/test.html – OK
    IE http://seetasmaniapass.iventurecard.com/test.html – OK, except style
    IE http://seetasmaniapass.iventurecard.com/ —– NOT AT ALL

    I have used
    wp_enqueue_script(‘jumpMenu’, ‘http://iventurecard.com/_jumpMenu/jumpBar.js’);
    add_action(‘jumpMenu’, ‘getData’);
    in the <head> of the header before wp_head();

    and then
    <body onload=”getData()”>

    I included simple alert to display but even that does not want to work under wordpress.

    I had a lot of issues with and I found the fixes but I really don’t know where else to look for the resolution. I know that the IE displays javascript from test.html and the FF can display everything but not AJAX from IE under wordpress?

    I appreciate any suggestions

    Bogdan

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter bogdan747

    (@bogdan747)

    Seriously? there is not even one person that knows how wordpress works?
    DO you need more information?
    C’mon guys, it’s been a week.

    Review Using_Javascript. If you continue to have problems then the issue is within your JavaScript – not WordPress.

    Thread Starter bogdan747

    (@bogdan747)

    Thanks esmi,

    I have read that page before I posted the first request and that’s where I got wp_enqueue_script() and add_action() from. I also read the external links to http://digwp.com/2009/06/including-jquery-in-wordpress-the-right-way/ but
    One thing I forgot was to include the version number of the word press that the client is using – WP 3.0.3,
    I have installed the 3.2.1 on my server at http://word.atcentre.com/ and it works OK.

    Should i still review that page, or is there something I need to change in wordpress 3.0.3 on the client sites, they have 11 instances of 3.0.3 running?

    Thanks for the reply
    Bogdan

    WP 3.0.3 uses an older version of jQuery compared to 3.2.1.

    You’re not dealing with a WordPress or a jQuery problem. You’re dealing with an IE JavaScript problem.

    The issue is being caused by IE not firing your onload event attached to the body tag. Without editing your code, I can’t verify why. I can verify that that’s the point of failure though, because in IE you can load your site, go to Tools > Developer Tools > Script Tab. Run getData(); in the console, and your header loads fine.

    Based on that, I know that the function runs in IE, it’s just not being called. Your most likely solution will be to get rid of the onload attribute on your <body> tag, and instead call getData() from inside your jQuery(document).ready block in jumpBar.js. That should solve it, since getData() runs fine when your select elements are changed in IE, which means your jQuery ready event is being fired.

    If that doesn’t work, Google around for articles related to Internet Explorer onload failure.

    Thread Starter bogdan747

    (@bogdan747)

    Thanks pdclark

    That worked OK, and I include the code for posterity.
    I had a doc.ready section but only fired on select (any select)
    so i just commented the jQuery(“select”).change(function(){ and related });
    ———————
    jQuery(document).ready(function(){
    // Location Selector
    // jQuery(“select”).change(function(){
    getData();
    // });
    });

    It even seem to load sooner than last time.

    All that said, why the onload worked fine in (IE) on WP-3.2.1 and and on stand alone pages as well but not in WP-3.0.3? Rhetorical question, don’t expect the answer, i am happy it works ……

    Thanks Again
    Bogdan

    You’re correct that it does load faster.

    OnLoad fires when all HTML, CSS, JavaScript, Images, etc are completely done loading.

    DOMReady, the event that drives jQuery(document).ready(), fires as soon as HTML is loaded and ready to be manipulated by JavaScript.

    Mostly because of images, onLoad fires much later than DOMReady, and in almost every circumstance, DOMReady is preferred.

    Thread Starter bogdan747

    (@bogdan747)

    Sorry for confusion in this post but I have to make a correction to it, just in case some one else is looking at the same issues.

    Getting the onload into jQuery itself did not fix the problem with IE not loading. I only found that after trying to deploy on other sites. But I still left the doc.ready as a better option

    jQuery(document).ready(function(){
    getData();
    });

    What I had to do to fix the not loading IE issues was ……
    deregister and register a new version of jQuery. code below.

    <?php
    wp_deregister_script( ‘jquery’ );
    wp_register_script( ‘jquery’, ‘http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js&#8217;);
    wp_enqueue_script( ‘jquery’ );

    wp_enqueue_script(‘jumpMenu’, ‘http://iventurecard.com/_jumpMenu/jumpBar.js&#8217;);
    add_action(‘jumpMenu’, ‘getData’);
    ?>

    I hope this helps some one,
    Thank you all for help
    Cheers
    Bogdan

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘wordpress javascript in IE’ is closed to new replies.