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 3333468
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T23:48:00+00:00 2026-05-17T23:48:00+00:00

I have the following link which opens a jquery modal window: <div id=’confirm-dialog’><a href=’#’

  • 0

I have the following link which opens a jquery modal window:

<div id='confirm-dialog'><a href='#' class='confirm'><img src='1.png' /></a></div>

and the following JS code which processes it:

jQuery(function ($) {
    $('#confirm-dialog input.confirm, #confirm-dialog a.confirm').click(function (e) {
        e.preventDefault();

        confirm("Are you sure you want to delete item id='IDNUMBER'.", function () {
            window.location.href = 'path to php process script';
        });
    });
});

function confirm(message, callback) {
    $('#confirm').modal({
        closeHTML: "<a href='#' title='Close' class='modal-close'>x</a>",
        position: ["30%",],
        overlayId: 'confirm-overlay',
        containerId: 'confirm-container', 
        onShow: function (dialog) {
            var modal = this;

            $('.message', dialog.data[0]).append(message);

            // if the user clicks "yes"
            $('.yes', dialog.data[0]).click(function () {
                // call the callback
                if ($.isFunction(callback)) {
                    callback.apply();
                }
                // close the dialog
                modal.close(); // or $.modal.close();
            });
        }
    });
}

I am unable to solve two issues:

  1. How do I pass the ID variable (perhaps other variables) into the javascript function so that when I submit ‘yes’ on the confirmation window, the php path will include something like : http://www.pathtophp.com?ID=12345

  2. How do I display the ID variable within the popup text (shown as: …delete item id=”IDNUMBER”…)

  • 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-17T23:48:00+00:00Added an answer on May 17, 2026 at 11:48 pm

    You could simply in the head of the page the PHP generates (before including the other JS files) add

    <script type="text/javascript">
    //Assumes id is passed in the URL
    var id = <?php print $_GET['id'];?>;
    </script>
    

    Then the variable “id” is available to all JavaScript functions on the page.

    Alternatively, if there are multiple links on the page you are wanting to apply this functionality to, you could add the id to the rel attribute of the anchor tag:

    <a href="javascript:void(0)" class="confirm" rel="<?php print $id;?>">
    

    Then you’ll modify your jQuery function to

    jQuery(function ($) {
        $('#confirm-dialog input.confirm, #confirm-dialog a.confirm').click(function (e) {
            e.preventDefault();
    
            confirm("Are you sure you want to delete item id='"+ e.currentTarget.rel +"'.", function () {
                window.location.href = 'http://www.pathtophp.com?ID=' + e.currentTarget.rel;
            });
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following link which opens a dom window... <a href='#inlineContent' class='defaultDOMWindow'>(edit interests)</a><br
I have following XsL which opens the link in the same window. I would
I am using Fancybox. When the following link is clicked the modal window opens
I have the following javascript bookmarklet which opens a new popup window with a
I have an asp:LinkButton which require following - - call jQuery to open link
I have the following output (via link) which displays the var_dump of some XML
I have the following script, which is working for the most part Link to
How to do the following: I want to have a link [upload image] which
I have a master page which references a style in the following manner: <link
I have the following link on index page <td align=center><a href=../athena/admin/update.php?id=' . $data [keyword]

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.