$this.attr() stops Jquery dialog from opening

Posted by user342391 on Stack Overflow See other posts from Stack Overflow or by user342391
Published on 2010-06-05T11:36:49Z Indexed on 2010/06/05 11:42 UTC
Read the original article Hit count: 132

Filed under:
|
|
|
|

I am using the following code to post my form data to player/index.php and open it in a dialog. Because I have multiple of these forms in my table I need to use $(this).

But now it doesn't open in a dialog.

New code (doesn't open dialog but display data in url):

  $("#recordingdialog").dialog({
  //other options, width, height, etc...
     modal: true,
      bgiframe: true,
      autoOpen: false,
      height: 200,
      width: 350,
      draggable: true,
      resizeable: true,
      title: "Play Recording",});

$(this).click(function() {
  $.post('player/index.php', $(this).attr('form').serialize(), function (data) {
       $("#recordingdialog").html(data).dialog("open");
  });
  return false;
});

Old code (only works on one form):

      $("#recordingdialog").dialog({
  //other options, width, height, etc...
     modal: true,
      bgiframe: true,
      autoOpen: false,
      height: 550,
      width: 550,
      draggable: true,
      resizeable: true,
      title: "Play Recording",});


$("#wavajax button").click(function() {
  $.post('player/index.php', $("#wavajax").serialize(), function (data) {
       $("#recordingdialog").html(data).dialog("open");
  });
  return false;
});

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about AJAX