0

I have a question regarding jquery. My code looks like this:

 <button id="callConfirm'.$row['id'].'">DEL</button>


    <div id="dialog" title="Realy?">
 Realy delete '.$row['marks'] .' s váhou   '.$row['weight'] .' z   '.$row['id']  .' ?
</div>​

 <script type="text/javascript">
$("#dialog").dialog({
 autoOpen: false,
modal: true,
 buttons : {
    "Opravdu" : function() {

   alert("You have confirmed!");        },
    "Ne" : function() {
      $(this).dialog("close");
    }
  }
});

$("#callConfirm'.$row['id'].'").on("click", function(e) {
e.preventDefault();
$("#dialog").dialog("open");  
});
 </script>'  

And I needed to click on in order to Opravdu execute delele.php script that looks like this:

 <?php
 include 'conn.php';
 $back = urldecode($_GET['back']);
 $id = mysql_real_escape_string($_GET['id'] * 1);
 mysql_query("DELETE FROM znamky WHERE id=$id");
 ?>
1
  • And I needed to click on in order to Opravdu execute delele.php Commented Dec 30, 2012 at 8:52

1 Answer 1

1
"Opravdu" : function() {
  $.get("delete.php?id=...&back=...",function(data) {
   alert(data);
  });
}

where data is returned from the delete

Here is how you might want to pass the ID to the gialog

jquery-ui, Use dialog('open') and pass a variable to the DIALOG

Sign up to request clarification or add additional context in comments.

1 Comment

OK, resolved. "Opravdu": function(event, ui) { var $led = $("#dialog"); $led.load("delete2.php?id='.$row['id'] .' ") ; $(this).dialog("close"); alert("Úspěch") ; }, Thank you

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.