Modifying dialog title after init
I'm using this code to init my dialog
- $(document).ready(function(){
$('#vendorinfo').dialog({autoOpen: false});
$("[class*=vendorlink]").click(function(e){
e.preventDefault();
var id = $(this).attr('class').match(/vendorlink-([0-9]*)/,"$1")[1];
$('#vendorinfo').load('vendorinfo.php?user_id='+id,function(){
$('#vendorinfo').dialog('open');
});
});
});
The dialog is called from this code:
- <a title="Click for Contact Info"
class="vendorlink-258"
href="javascript:;">My Company</a>
What I'd like to know is how I can set the dialog's title to something returned in the load, in particular the company name.
Here is vendorinfo.php:
- require_once "libs/Core.php";
$user_id = $_GET["user_id"];
$select_sql = "SELECT * FROM ".TABLE_PREFIX."user_directory where user_id=".$user_id;
$db = new Database;
$result = $db->query($select_sql);
while($row = mysql_fetch_array($result))
{
echo "<h2>Viewing Company ".$row["company_name"]."</h2><br>";
if(strlen(trim($row["logo_path"])) > 0) {
echo "<img border=0 src='".$row["logo_path"]."'/>"."<br>";
}
echo "<br>";
echo "<a href='mailto:".$row["email"]."'>".$row["email"]."</a>";
echo "<br>";
echo $row["address"]."<br>";
echo $row["city"].", ".$row["state"]." ".$row["zipcode"]."<br>";
echo "Phone: ".$row["phone"]."<br><br>";
if(strlen(trim($row["comments"])) > 0) {
echo "Comments: ".$row["comments"]."<br><br>";
}
}