2011-04-25 2 views

답변

3

사용 window.confirm() 어떻게 내 HTML

<span class="delete"><a rel="<?php print $step['step_number']; ?>" class="delete_step" href="#">Delete Step</a></span> 

내 JQuery와

$('.delete_step').live('click', function(e) { 
e.preventDefault(); 
    var delete_location = window.location.pathname.replace('admin/', '') + '?route=module/cart/delete_step'; 
    $.post(delete_location, { step_id: $(this).attr("rel"), template_number: "<?php print $template_id; ?>" }, 
     function(result) { 
      var token = window.location.search.match(/token=(\w+)/)[1]; 
      window.location.href = window.location.pathname + '/index.php?route=system/template&token=' + token; 
    }); 
}); 

입니다. 이 같은

$('.delete_step').live('click', function(e) { 
    e.preventDefault(); 
    if (confirm('Are you sure?')) { 
     // do the $.post() 
    } 
} 
1

뭔가 (테스트되지 않음)

$('.delete_step').live('click', function(e) { 
    e.preventDefault(); 
    var answer = confirm("Are you sure?") 
    if (answer){ 
     var delete_location = window.location.pathname.replace('admin/', '') + '?route=module/cart/delete_step'; 
     $.post(delete_location, { step_id: $(this).attr("rel"), template_number: "<?php print $template_id; ?>" }, 
     function(result) { 
      var token = window.location.search.match(/token=(\w+)/)[1]; 
      window.location.href = window.location.pathname + '/index.php?route=system/template&token=' + token; 
     }); 
    }else{ 
     alert('fail!'); 
    } 
    }); 
0

이이 기능을 계속하기 전에 요청합니다 :

+0

하! 내가 이길 것 같아. – BraedenP

1
 
$('.delete_step').live('click', function(e) { 
    e.preventDefault(); 

     if(confirm("Message to be popped up?")) 
     { 
     var delete_location = window.location.pathname.replace('admin/', '') + '?route=module/cart/delete_step'; 
     $.post(delete_location, { step_id: $(this).attr("rel"), template_number: "" }, 
      function(result) { 
       var token = window.location.search.match(/token=(\w+)/)[1]; 
       window.location.href = window.location.pathname + '/index.php?route=system/template&token=' + token; 
     }); 
     } 
    }); 
관련 문제