sql db to dialog window

sql db to dialog window

Hi guys!
I am new.

I have a table in jqueryUI dialog window. How can i getting data from sql database to table cells?
I failed with ajax =\

When open-event of modal dialog_window i try to get one row from sql db where id = var from another_element (var is passed successfully here, I checked).

  1. $("#dialog_window").dialog({ open: function() { var id = $("#another_element").data('id'); $.ajax({ type: 'POST', url: 'response.php', data: id, success: function(data) { alert(data['F']); //try to show one of the elements of the array }, error: function(xhr, str){ alert(xhr.responseCode); } }); }, ......... ......... });


  1. <?php $name = 'name'; $password = 'password'; header("Content-Type: text/html;charset=utf-8"); mysql_connect("localhost", "$name", "$password") or die(mysql_error()); mysql_select_db("database") or die(mysql_error()); $str = "Select * from table WHERE id='".$_REQUEST['id']."'"; $result = mysql_query($str) or die(mysql_error()); $row=mysql_fetch_assoc($result); //I tried to use mysql_fetch_assoc and //mysql_fetch_row mysql_close(); echo($row); ?>