Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6593975
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:45:05+00:00 2026-05-25T17:45:05+00:00

Hello fellow stackoverflow-ers, I built an ajax image gallery and used asual’ jquery address

  • 0

Hello fellow stackoverflow-ers,
I built an ajax image gallery and used asual’ jquery address for the deep linking.
The error happens, right after loading the gallery, on the first onclick when clicking on the image or on all the clicks of the thumbnails.

Basically, my code on the image is:

<li id="thumbnail_<?php echo $row->position;?>"><a href="javascript:;" onclick="javascript:setAddress('<?php echo $row->url;?>');"><img src="<?php echo $row->filePath;?>" /></a></li>

my code on the thumbnails is:

<li id="thumbnail_<?php echo $row->position;?>"><a href="javascript:;" onclick="javascript:setAddress('<?php echo $row->url;?>');"><img src="<?php echo $row->filePath;?>" /></a></li>

so that when I click, I change the address in the address bar using setAddress:

<script type="text/javascript">
    function setAddress(address){ 
        $.address.value(address.replace(/^#/, ''));
    }
</script>

and then I detect the change in the address and reload the image (and thumbnails accordingly) in ajax.

<script type="text/javascript">
    $.address.change(function(event) { 
        checkAnchor();
    }); 

    function checkAnchor(){
        var albumId = <?php echo $albumId;?>;
        if($.address.value() != '' && $.address.value() != '/'){
            //get the id of the image
            var arData = $.address.value().split("-");
            var arIdExt = arData[1].split(".");
            var id = arIdExt[0];
            reloadImage(albumId,id,'0','curr');
        }else{
            reloadImage(albumId,id,'1','curr');
        }
    }

    function reloadImage(albumId, photoId, position, action){
    $("#imgLoading").show();
    var visibleThumbnails = <?php echo $visibleThumbnails;?>;
    var albumName = $("#albumName").val();
    $.post('/montreal/inc/ajax/changeImage.php',{albumId:albumId, photoId:photoId, position:position, action:action}, function(data){
        //data + photoposition=[url]
        var arData = data.split("photoposition=");
        if(position == 0){
            position = jQuery.trim(arData[1]);
        }

        $("#photo-details").html(arData[0]);
        $.address.title(albumName+" - Photo #"+position);
        $("#imgLoading").hide();

        //reload the thumbnails
        if(action == 'next'){               
            var maxThumbnails = <?php echo count($album->arPhotos['photos']);?>;
            var nextPosition = position+1;
            var currentRow = Math.ceil(position/visibleThumbnails);
            if(nextPosition > maxThumbnails){ nextPosition = 1;}                            
            if(position%visibleThumbnails == 0 || position == maxThumbnails){
                reloadThumbnails(currentRow,visibleThumbnails,albumId,nextPosition,'next');
            }else{//fix the activeposition of the reloadThumbnails
                reloadThumbnails(currentRow,visibleThumbnails,albumId,nextPosition,'curr');
            }               
        }else if(action == 'curr'){
            var maxThumbnails = <?php echo count($album->arPhotos['photos']);?>;
            var currentRow = Math.ceil(position/visibleThumbnails);
            reloadThumbnails(currentRow,visibleThumbnails,albumId,position,'curr');
        }
    },"html"  
);

}

The “stack overflow at line 0” appears right after the click and before the setaddress, so that I am pretty confused as to where it could come from. After clicking on the error message, nothing happens, and after clicking on the image again, the gallery actually works. But if I click on the thumbnails, the error appears, but if I click on the thumbnails again, the error still appears.

As far as I’ve read, this error is way generic and is usually caused by a loop or a recursion. But I cannot see one, especially when I can see it happen only on the first click in the gallery.

Anyone has a hint as to where I should search?

Example of the error:
http://www.ckoi.com/montreal/photos/gala-des-gemeaux-tapis-rouge-194/

EDIT:
After some tests, I realized that the error actually happens right after I loaded my page. Anywhere I click, I get a stack overflow. So that I am even more confused… But maybe it’s because I load the gallery a first time in ajax? I’ll investigate

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T17:45:06+00:00Added an answer on May 25, 2026 at 5:45 pm

    From the original poster:

    Ok, I found it. I’m really not sure why this was causing such trouble for IE, but here it was:

    In order to keep track of the album title and not to have to get it in every one of my ajax calls, I kept it in an invisible text input :

    <input id="albumName" type="text" style="display:none;" value="<?php echo $album->name;?>"/>
    

    If the title had double spaces in that hidden input, IE was complaining… To me, this makes no sense, but now it works…

    Thanks guys for your insights! Hopes this helps someone else to debug IE….

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello fellow Stackoverflow users, I have a page which does a AJAX request to
Hello my fellow stackoverflower, i'm looking for away to smooth an image of and
Fellow JQuery hackers, hello :-) Suppose you have the following code: $('.links').click(function(){ //Do something
Hello stackoverflow fellow members? Struct Declaration in class A struct PointSprite { GLfloat x;
Hello fellow developers! We are almost finished with developing first phase of our ajax
Hello fellow StackOverflow users (or Stackoverflowers ?): I'm learning-by-coding WPF. I read several articles/saw
Hello fellow stackoverflow family members? I know it is un-efficient to create one extra
Hello fellow stackoverflow members! I'm very new to the C# language transfer from Java,
Hello fellow drupalers, I have a question about ajax loaded views. Lets say i
Hello fellow StackOverflowers. I'm have a brain fart right now, and I cannot seem

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.