ASP.NET / JQUERY - Pass value to dialog

jamesdean666
jamesdean666 used Ask the Experts™
on
I am a newbie to JQuery.  I have the following code in my global JQuery page - global.js.

$(".documentor").live("click", function () {
            childDialog("/common/HelpfulHints.aspx?q=" + $(this).attr("id"), "Add New Documentation " + " - " + $(this).attr("id").replace("_", " "), 500, 450, parent.main);
            
I want to pass a value from any page the user is currently on (that calls childDialog) to the Dialog page - /common/HelpfulHints.aspx

For example, I would like to pass the value of alert($(this).attr("id")  or escape(document.location.pathname)) to a TextBox (txtHHElementID) on  /common/HelpfulHints.aspx

How is this done?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Michel PlungjanIT Expert
Top Expert 2009

Commented:
What is the problem?

Looks ok to me except .live() is deprecated.

I would format the code better

$(document).ready(function() {
  $(".documentor").live("click", function () {
    var URL = "/common/HelpfulHints.aspx?q=" + 
       $(this).attr("id"), "Add New Documentation " + 
       " - " + $(this).attr("id").replace("_", " ")
    childDialog(URL , 500, 450, parent.main);
  });
});

Open in new window

Meir RivkinFull stack Software Engineer
Commented:
if your textbox id on  /common/HelpfulHints.aspx is for example: id="txtHelpfulHints"

then u can set its text like this:

$("#txtHelpfulHints).text($(this).attr("id"));
IT Expert
Top Expert 2009
Commented:
In helpfulhints you need to do

$(document).ready(function() {
  $("#txtHHElementID").html(unescape(location.search.substring(1)));
}

unless you want the aspx to handle it

<span><%= Server.URLDecode(Request.Querystring("q")) %></span>

or similar

Author

Commented:
Thanks.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial