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

  • Home
  • SEARCH
  • 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 6600059
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:34:21+00:00 2026-05-25T18:34:21+00:00

I have a loop called from a database, each loop has a link that

  • 0

I have a loop called from a database, each loop has a link that has unique url. I’m using a modal script to load the link in a div, however it will only work with the 1st link. The other links called from the database won’t open in the modal. They open in a new window. How can I fix this? I’ve tried ($(‘#ajax2’).each(function()) but that doesn’t work.

Here’s the script.

    if($totalRows_games>0)
    { ?> 
    <a id="ajax2" title="Pending Challenge" href="FBaction.php?tid=<?php echo $tid?>"     onClick="self.location=this.href; return false">Action</a> <?php }} while ($row_games =     mysql_fetch_assoc($games)); ?><? }?>

        $('#ajax2').click(function(){
        var url = $(this).attr('href'); //get the attribute href
        var title = $(this).attr('title'); //get the attribute href

        lightbox.alert({
        width: '400px',
        title: title,
        rightButtons: ['Close'],
        background: 'none',

        opened: function(){
            $('<span />').load(url).appendTo('#lbContent');
        },
        buttonClick: function(button){
            console.log(button);
        }
    });
    return false;
});
  • 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-25T18:34:21+00:00Added an answer on May 25, 2026 at 6:34 pm

    Modify your function and as follows

        $('#ajax2').click(function(event){
            event.preventDefault();
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a loop that reads each line in a file using getline() :
I have some data from database coming out in a loop. Each of these
I have a PHP script that works by calling items from a database based
I have code below that is getting called from a while loop so it's
On Linux under X11 and using GTK+ you have something called Main Loop. Once
I have two SQL scripts which get called within a loop that accept a
I have a loop on page to update an access database that takes 15-20
If I have a LINQ to SQL table that has a field called say
So I have some data that's coming back from a database query, and the
In my app I have a background task (using AsyncTask) that downloads stuff from

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.