简体   繁体   English

需要jQuery Dialog进行确认并将Ajax请求发送到Controller Action

[英]Need jQuery Dialog for confirmation and Send Ajax Request to Controller Action

i have simple tr an td's coming from database 我有简单的tr和td来自数据库

<tr>
<td >
  <td style=" display:none"> <?php echo $record['id_to_send'];?></td>
 <?php if($record['user_value'] == 1)
 <a href="#"><img src="Green.png" /></a>
 else <a href="#"><img src="Red.png" /></a>?>
 </td>
</tr>

What i want to do is that if Green Image is clicked i want jQuery Dialog with confirm Button and if user confirm that i want to send ajax request to my Controller Action1 with data $record['id_to_send']; 我想要做的是,如果点击绿色图像我想要jQuery对话与确认按钮,如果用户确认我想要向我的控制器Action1发送ajax请求数据$record['id_to_send']; .if Red image is clicked after confirmation i want to send ajax request to my Controller Action2 with data $record['id_to_send']; .if确认后点击红色图像我想用数据$record['id_to_send'];向我的Controller $record['id_to_send'];发送ajax请求$record['id_to_send'];

To send AJAX on OK confirmation: 要在确认时发送AJAX:

$( "<div>Confirmation</div>" ).dialog({
   modal:true,
   buttons: {
        "OK": function() {
             sendAjax(); //Your ajax function
             $(this).dialog( "close" );
         },
         "Cancel": function() {
             $(this).dialog( "close" );
         }
   }
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM