For a web-app I'm developing, I need to pass the current user to a jqueryUI dialog box. Right now, I'm trying out simple examples to get to this point. I'm trying to pass the contents of "p" tag from parent page, to be displayed in the jqueryUI dialog.
$(document).ready(function(){
$('#test').each(function() {
var $link = $(this);
var $dialog = $('<div></div>')
.data('test',$("test_p"))
.load($link.attr('href') + ' #content')
.dialog({
modal: true,
autoOpen: false,
title: $link.attr('title'),
width: 500,
height: 300
});
$link.click(function() {
$dialog.dialog('open');
return false;
});
});
Here, test_p is the p tag I want to send to my dialog box. I am displaying the "content" div from a HTML file -
<html>
<head>
<title>Add link</title>
<body>
<div id="content">
<!-- CONTENT OF <P> FROM THE CALLER PAGE -->
<form id="info" method="POST" action="/">
Link : <input type=text name="thelink"/><br>
tag : <input type=text name="thetags"/><br>
<input type=submit name='submit' value="submit"/>
</form>
</div>
</body>
I want it such that, the content of the p tag is displayed in the dialog.
Is .data() the way to do this? Or is there a better way to do this?
And, sorry if I've got some terminology wrong... I'm rather new to jquery.