Submit Your Article Forum Rules

Results 1 to 9 of 9

Thread: AJAX Issues - multiple uses not cooperating

  1. #1
    Senior Member
    Join Date
    Jul 2003
    Posts
    293

    AJAX Issues - multiple uses not cooperating

    I am developing a site and would like to use the fisheye navigation menu and lightbox image AJAX features. I encounter a problem when they both occur on the same page... which will be quite often.

    You can see the two demo's here:

    Sands Villas v1 - Fisheye.

    Sands Villas v1 - Lightbox.

    Independantly they both work well and as they should. I added the lightbox after and it caused the problems.

    I narrowed it down to something in the

    <script type="text/javascript" src="js/prototype.js"></script>

    file. If I comment that out, then the fisheye works and the link for the image works as well (without the lightbox, just opens image old fashioned style in the browser).

    I know so little about the ins and outs of AJAX and JavaScript that I wouldn't know where to begin.

    Can anyone help me out with this?

    thanks
    Rob

  2. #2
    WebProWorld MVP DaveSawers's Avatar
    Join Date
    Dec 2006
    Location
    Lunenburg, Nova Scotia, Canada
    Posts
    760

    Re: AJAX Issues - multiple uses not cooperating

    I couldn't see a prototype.js in either version you reference.

    How are you doing the AJAX stuff? If you have just written your own simple code to handle the AJAX, then you need to be careful to use different object names in the JavaScript for different events that may be fired around the same time or for the same event that may be fired many times in succession. Since AJAX is asynchronous, AJAX calls may not be completed in the order they were fired off.
    Dynamic Software Development
    www.activeminds.ca

  3. #3
    WebProWorld MVP wige's Avatar
    Join Date
    Jun 2006
    Posts
    3,138

    Re: AJAX Issues - multiple uses not cooperating

    First, both example links point to the same example, which is the fisheye, so I couldn't test the lightbox.

    From your explanation, though, it sounds like you are using Javascript libraries created by third parties to generate the fisheye and lightbox capabilities. If these systems were created by different developers (or possibly even the same developer) it is possible they have similar naming conventions. I would scan through the code for the two systems to try to find any duplication of variable names.

    Additionally, there are a few tools that I have found useful for diagnosing scripting problems. The first is if you use Internet Explorer 8 Beta, the built in Developer Tools includes a runtime analyzer for Javascript that may be able to locate the issue. If you use Firefox, the Firebug and Console2 addons can give a lot of diagnostic information.
    The best way to learn anything, is to question everything.
    WigeDev - Freelance web and software development

  4. #4
    Member
    Join Date
    Mar 2007
    Posts
    46

    Re: AJAX Issues - multiple uses not cooperating

    I've used the lightbox javascript a couple of times. According to the author of the script, sometimes multiple javascripts on the same page cause problems.

    His lightbox documentation provides a solution that works for me:

    In the <body> tag of the page there is typically an "onload" line to pre-load the images. At the end of this line, still in the body tag, append ;initLightbox()

    ... Duane

  5. #5
    WebProWorld MVP deepsand's Avatar
    Join Date
    May 2004
    Location
    State College, PA
    Posts
    16,449

    Re: AJAX Issues - multiple uses not cooperating

    Correct URL for the Lightbox example is Sands Villas v1 .

  6. #6
    Senior Member
    Join Date
    Jul 2003
    Posts
    293

    Re: AJAX Issues - multiple uses not cooperating

    All, deepsand found the correct URL for the light box - thanks... I will look at the suggestions by wige and dray and report back any findings.

    Rob
    Rob

  7. #7
    Senior Member
    Join Date
    Jul 2003
    Posts
    293

    Re: AJAX Issues - multiple uses not cooperating

    Well after much more head scratching, I have not been able to figure it out. There is no onload in the body and thus the dray didn't work and as stated in my original post my knowledge of JS is very very limited.

    Can anyone find the time to take a closer look at this and let me know if there is a solution... I would really like to use both features, but cannot spend any more time banging my head against the wall with no progress or solution.

    Please help
    Rob

  8. #8
    WebProWorld MVP kgun's Avatar
    Join Date
    May 2005
    Location
    Norway
    Posts
    7,999

    Re: AJAX Issues - multiple uses not cooperating

    Quote Originally Posted by DaveSawers View Post
    I couldn't see a prototype.js in either version you reference.
    That file is here:

    http://sandsvillasbelize.com/js/prototype.js

    Quote Originally Posted by wige View Post
    Additionally, there are a few tools that I have found useful for diagnosing scripting problems. The first is if you use Internet Explorer 8 Beta, the built in Developer Tools includes a runtime analyzer for Javascript that may be able to locate the issue. If you use Firefox, the Firebug and Console2 addons can give a lot of diagnostic information.
    I suggest that you install Firebug - Web Development Evolved and learn to use

    (KW search: firebug tutorials)

    that tool. That may solve your problem.

    Introduction to Debugging AJAX Application with Firebug

  9. #9
    Member
    Join Date
    Mar 2007
    Posts
    46

    Re: AJAX Issues - multiple uses not cooperating

    Use this as your body tag:

    <body onload="initLightbox()">

    and see what happens....

    ... Duane

Similar Threads

  1. Multiple Merchant Accounts for Multiple Stores?
    By Marc Bowker in forum eCommerce Discussion Forum
    Replies: 13
    Last Post: 08-31-2007, 09:52 AM
  2. Multiple css for multiple browsers/ platforms
    By slideri812 in forum Graphics & Design Discussion Forum
    Replies: 4
    Last Post: 10-06-2005, 12:45 PM
  3. Recapping multiple domain Issues SEO Issue.
    By woconno4 in forum Search Engine Optimization Forum
    Replies: 4
    Last Post: 09-13-2005, 03:46 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •