Alertify JS - 获取用户输入值

时间:2015-06-29 06:07:12

标签: jquery alertify

使用以下代码段允许用户输入并稍后获取该输入值

alertify.prompt('Please enter your comments', 'some value', 
    function(evt, value){ alertify.message('You entered: ' + value);}
);


alertify.confirm("Are you sure you want to submit data for selected date range ?", function (e) {

alertify.prompt('Please enter Desc:').set('type', 'text'); 
alertify.prompt('This is a prompt dialog!', '', function(evt, value){  
    alertify.message('You entered: ' + value);
});              

//fetch user input value here and pass in URL
var user_value = value;

if (e) {
    alertify.success("Data has been submitted");
    $.post(
        SITE_URL+"someurl/action",
        $("#frm_submit").serialize()+ "&res_ids="+res_ids,
        function( data ) {
            window.location.href='<?php echo SITE_URL."someurl/action?project_id=".$_GET['project_id']."&action=submit"; ?>';
    });
} else {
    alertify.error("Your data is not submitted");
}

但它会抛出异常

Error: fn must be a function
..."!=typeof c&&"function"!=typeof c)throw new Error("fn must be a function");retur...

如何在textarea中允许用户输入,获取该值并在提交表单之前将其传递给URL?

版本 - v0.3.11

0 个答案:

没有答案