jquery确认后的jquery弹出窗口

问题描述:

点击jsp中的“删除”链接后,我有一个确认框。现在问题是成功删除页面显示在同一个窗口中。jquery确认后的jquery弹出窗口

我想在弹出的窗口中显示它。

我试图使用javascript onclick(),但它不是wotking。那么,我该怎么做?

<script type="text/javascript" src="jquery-1.4.2.min.js"></script> 
<script type="text/javascript" src="jconfirmaction.jquery.js"></script> 


<script type="text/javascript"> 

      $(document).ready(function() { 


       $('.ask-plain').click(function(e) { 

        e.preventDefault(); 
        thisHref = $(this).attr('href'); 

        if(confirm('Delete this record?')) { 
         window.location = thisHref; 
        } 

       }); 

       $('.ask-custom').jConfirmAction({question : "Anda Yakin?", yesAnswer : "Ya", cancelAnswer : "Tidak"}); 
       $('.ask').jConfirmAction(); 
      }); 

     </script> 

<meta http-equiv="content-type" content="text/html; charset=utf-8" /> 


<SCRIPT TYPE="text/javascript"> 
<!-- 
function popup(mylink, windowname) 
{ 
if (! window.focus)return true; 
var href; 
if (typeof(mylink) == 'string') 
    href=mylink; 
else 
    href=mylink.href; 
window.open(href, windowname, 'width=750,height=430,scrollbars=no'); 
return false; 
} 
//--> 
</SCRIPT> 

---Delete image 
<td width="3%" align="left"><a href="cir_delete.jsp?cir_id=<%=rs.getString("cir_id")%>" class="ask"><IMG SRC="12.png" ALT="Delete" BORDER="0"></a></td> 

感谢名单

当你点击删除
+0

我没有看到任何代码? – Ties 2010-08-02 08:41:46

+0

为什么我感觉这个问题与[jconfirm-form-submit-returns-incorrect-value-to-php]类似的问题(http://*.com/questions/3385574/jconfirm-form-submit-returns -incorrect-value-to-php)。一些功课? – Reigel 2010-08-02 08:50:21

+0

这是有点不同 – maas 2010-08-02 09:35:51

,显示确认对话框,之后的形式提交。

你需要做的是提交表单槽jquery,cathc的结果并显示传递给一个弹出框。我会很快给出一个例子。

我与jconfirm做过一次:

<script type="text/javascript"> 
     $(document).ready(function(){ 
      // give all your delete links a class="del" then when this is clicked, execute following: 
      $(".del").click(function() { 
      //get the href from th link you clicked 
      var href = $(this).attr("href"); 
       activate JConfirm 
       jConfirm('Can you confirm this?', 'Confirmation Dialog', function(r) { 
        // if confirm is clicked: 
        if(r){ 
         //post the form serialised to the url 
         $.post(href, $("#yourtestform").serialize(), 
          function(data){ 
          // the posted form will return html data, load this data in a hidden div 
          $('#loadhtml').html = data; 
          // now that the data is loaded, open a colorbox with the hidden div as content (don't forget to include the colorbox.js 
          $('#loadhtml').colorbox(); 
          }; 
         ); 
        } 
        //if the person clicked cancel: do nothing 
        else{ 
         return false; 
        } 
       }); 
       // insure that the form doesn't post itself again after jquery is finished 
       return false; 
      }); 
     }); 
    </script> 

我假设你想用一个模式弹出像colorbox什么 在底部,您可以在后门柱加载HTML和隐藏定义一个div它:

<div style="display:hidden" id="loadhtml"> 
</div> 
+0

对不起,你能请多解释一下 //调用弹出框函数加载html ,因为我有点困惑 – maas 2010-08-02 09:35:04

+0

现在,我应该完全删除我的代码吗?并将其替换为您发布的那个? – maas 2010-08-02 10:28:33

+0

我添加了一些评论,它可能不是语法正确的,因为我只是在这里写的,并没有在浏览器或任何东西中测试它。但我确信基础知识将起作用并且流程将起作用 – Nealv 2010-08-02 11:47:27

如果你需要*的版本 - jconfirmaction.jquery.js,将分享给你。