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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:52:39+00:00 2026-05-27T13:52:39+00:00

I am wanting to pass a variable to a jquery dialog window. I am

  • 0

I am wanting to pass a variable to a jquery dialog window. I am using classic ASP and have onyl really touched on the world of jquery. I have spent a few hours researching and tring to use the .data method but are having trouble. Your time and assitance would be very much apriciated!

Here is my stripped down page:

    $(function(){
            // Dialog           
            $('#dialog').dialog({
                autoOpen: false,
                show: "slide",
                hide: "fade",
                width: 452,
                modal: true,
                buttons: {
                    "Ok": function() { 
                        PostItNote.submit();
                        $(this).dialog("close"); 
                    }, 
                    "Cancel": function() { 
                        $(this).dialog("close"); 
                    } 
                }
            });

            // Dialog Link
            $('#dialog_link').click(function(){
                $('#dialog').dialog('open');
                return false;
            }); 
        });

and this is how I call the window:

<a href='#' id='dialog_link' CLASS='OrangeButton'> Show Window </a>

and the contents of my window:

<div ID="dialog" TITLE="Periodic Report">
    stuff here
</div>

Why can I not do this:

<a href='#' id='dialog_link(someValue)' CLASS='OrangeButton'> Show Window </a>

Thank you in advance

How it is used in the ASP loop is:

   do until Products.EOF
      --other code here---
      <a href='#' id='dialog_link(Products(0))' CLASS='OrangeButton'>
      --other code here---
      products.moveNext
   loop
  • 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-27T13:52:40+00:00Added an answer on May 27, 2026 at 1:52 pm

    The dialog is just a div on your page, so it can’t really be “passed” a value. It can be manipulated by any JavaScript variables in scope though. You could change your click handler to use a variable to manipulate the dialog:

    var myVariable = "Some new text for the dialog";
    
    $('#dialog_link').click(function(){
    
        //New code to "pass" a value to the dialog
        $('#dialog').text(myVariable);
    
        $('#dialog').dialog('open');
        return false;
    });
    

    Or you could use the open member of the dialog:

    ...
    width: 452,
    open: function() { $('#dialog').text(myVariable); },
    modal: true,
    ...
    

    To make changes to the dialog div whenever it is opened.

    The code id='dialog_link(someValue)' will not do anything, as the id attribute cannot make function calls, only event handlers like onchange can do that. Even if it could, dialog_link is not a function that can be passed a value. It is just the id of another element.

    I’m sure you’re probably already aware, but the jQuery documentation is very useful- here are the docs for dialog.

    Edit

    In response to your comment: I would drop the $('#dialog_link').click(); statement and change the link code to the following:

    <a href='#' class='OrangeButton' onclick='openDialog(someValue);'>Show Window</a>
    

    And then add the JavaScript function to be called on the click event:

    function openDialog(value) {
        $('#dialog').text(value);
        $('#dialog').dialog('open');
    }
    

    Edit 2

    Inside of the ASP loop something like this should do the trick:

    Response.Write("<a href='#' onclick='openDialog(" & Products(0) & ");'>Show</a>")
    

    This will create an <a></a> element on the page with an onclick handler that passes the desired value to openDialog, making it accessible by the dialog.

    I changed the code for the link slightly so that it all fit on one line, but you could always add back the class='OrangeButton' and all that if you’d like.

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

Sidebar

Related Questions

I'm using pthread on Linux. I have a circular buffer to pass data from
I am wanting to pass a variable through to another form that will reveal
I have an issue with IE7 not wanting to pass a pickled object through
I'm wanting to get the full value of a char[] variable in the VC6
Besides just using yield for iterators in Ruby, I also use it to pass
I am wanting to pass something like the following to my view from my
I'm wanting to make sure I understand pass-by-value vs pass-by-reference properly. In particular, I'm
Possible Duplicate: How to pass an array via $_GET in php? So I have
So I have this big, hairy if/else statement. I pass a tracking number to
I am wanting to xor (^) two values and pass the result to an

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.