Jquery dialog with <a>

Jquery dialog with <a>

Here's an example of what I'm trying to tie a dialog to:
  1. <div id='dialog' title='Blog Post Viewer'></div>

  2. <a href='? $url_data ' onclick='return false' onmousedown=' run_modal ( \" $href \" , \" $url_data \" );'> $link_txt </a>

My goal is to be able to run "run_modal", and let it auto populate the dialog box with an ajax request.


When I run:
  
  1. $(function() {
  2. $( "#dialog" ).dialog({
  3. autoOpen: false
  4. });
  5. });

  6. function run_modal( href, url_data ) {
  7. $("#dialog").dialog("open");
  8. // alert(href+"="+url_data);
  9. }

It comes up with this bug:
jquery-2.1.4.js:250 Uncaught Error: cannot call methods on dialog prior to initialization; attempted to call method 'open'

What am I doing wrong to trigger the dialog call?
Is there a way you would suggest changing the title, and body content on a single ajax call to the server?