Jquery passing a parameter between functions

Itunesl65g

New Member
Hey i would to pass a parameter from a function in jquery, but i cant get it to work. what am I doing wrong? I would like to pass "name" from the click function to the dialog block function to prevent repeating of codeUpdate: I have define name after the function. however i still cannot pass it like this <%=GetUserName(name)%>Update 2 jsFiddle link http://jsfiddle.net/bbKw8/\[code\] <div id="dialog-block" > <p> <b>Friends List:</b> <% =GetFriends(0) %> </p> </div> <div id="Div1"> <p> <b>Friends List:</b> <% =GetFriends(0) %> </p> </div> <script type="text/javascript"> // the jQuery document ready handler $(function () { var name; // create our dialog $('#dialog-block').dialog({ title: '<%=GetUserName(name)%>', autoOpen: false, width: 400, buttons: { "Close": function () { closeDialog($(this)) } } }); // the button to open the dialog $('#user0chair,#apDiv1').click(function (event) { if (this.id == 'user0chair') { $('#dialog-block').dialog('open'); name = 1; } else if (this.id == 'user1chair') { $('#dialog-block').dialog('open'); } }); }); function closeDialog(elem) { elem.dialog("close"); } </script>\[/code\]
 
Back
Top