2017-09-30 1 views
0

Ich verwende https://craftpip.github.io/jquery-confirm/#customizing Plugin für das Popup. Ich brauche nur eine Hilfe Wenn Benutzer auf Confirm klicken, dann warum es nicht umleiten? Wenn ich alert() benutzt habe; dann wird es angezeigt.Aktion funktioniert nicht in jQuery-confirm

Die Funktion erhält keinen ID-Wert.

Würdest du mir dabei helfen?

<!DOCTYPE html> 
<html> 
    <head> 
    <title></title> 
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> 
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jquery-confirm/3.3.0/jquery-confirm.min.css"> 
    </head> 
    <body> 
    <?php 
     $delete_id=2; 
    ?> 
    <a href="javascript:void(0);" onClick="warning('<?php echo $delete_id;?>')" class="cross-cta"> 
     <i class="fa fa-times" aria-hidden="true"></i> 
    </a> 
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> 
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-confirm/3.3.0/jquery-confirm.min.js"></script> 
    <script type="text/javascript"> 
     function warning($id){ 
     $.confirm({ 
      title: 'DELETE SELECTED!', 
      content: 'Are you sure?.', 
      type: 'red', 
      typeAnimated: true, 
      theme: 'material', 
      buttons: { 
      tryAgain: { 
       text: 'Confirm', 
       btnClass: 'btn-red', 
       action: function(){ 
       window.location='mypage?action=empty&deletekey='+id+''; 

       } 
      }, 
      close: function() {} 
      } 
     }); 
     } 
    </script> 
    </body> 
</html> 
+0

versuchen Sie es window.location.href = "http://example.com/mypage?action=empty&deletekey=" + id; –

+0

@AmitVagner, ich habe versucht, aber nicht funktioniert –

+0

Es gibt ein Problem mit onClick = "Warnung ('')" Das. –

Antwort

0

Endlich fand ich mein Problem. Das Problem war function warning($id){ in dieser Zeile. Ich verwendete $ ID instated ID. Ich muss so function warning(id) verwenden und es funktioniert perfekt.

Verwandte Themen