有很多例子如何提交表單後點擊確認對話框上的確定按鈕,但我不能讓它的工作。表單提交使用jquery.confirm
<form class="myform" method="post"
action="<?php echo Configure::read('Settings.MYURL'); ?>">
<input type="hidden" name="type" value="bdt" />
<input type="hidden" name="data" value="<?php echo $session['Session']['id']; ?>" />
<input type="hidden" name="id" value="<?php echo $subscriber_id; ?>" />
<input type="hidden" name="p_id" value="<?php echo $available_packages['Package']['id']; ?>"/>
<input type="hidden" name="ext_id" value="<?php echo $available_exten_pack['id']; ?>"/>
<input type="hidden" name="redirected_from" value ="<?php echo $this->request->here; ?>" />
<input id = "loginurl" type="hidden" name="loginurl" value="<?php echo Router::fullBaseUrl() . Router::url(array('controller' => 'Home', 'action' => 'login')); ?>" />
<input class="btn btn-sm btn-primary pull-right extendpackage" type="submit" name="submit" value="Subscribe">
</form>
我使用jquery-confirm.js的對話框,警告等 如果用戶點擊提交按鈕或提交表單
$.confirm({
columnClass: 'col-md-4 col-md-offset-4',
theme: 'white',
title: 'Add',
content: 'do stuff',
confirmButton: 'Ok',
cancelButton: 'Cancel',
confirmButtonClass: 'btn-success',
cancelButtonClass: 'btn-danger',
confirm: function() {
// i want user submit my form
//which posts my data to an action
//
},
cancel: function() {
}
});
我試圖$('.myform').submit()
但它不工作
其工作像charm.thanks :) – Amran