我可以在另一个form.on('submit')上使用form.on('submit')吗? [英] Can I user form.on('submit') on another form.on('submit') ?
问题描述
问题是我必须运行第二个表单(提交发布)。当它被发布。它填充了它的值,我得到了值并将值发送到第一个表单。如上面的代码所示。并且第一个HAS首先运行frm-insert,如代码所示。它是显示引导模式(其中包含第二个多部分/数据形式)的模式。当主表单(第一个提交时,首先它调用第二个
表单。第二个表单裁剪图像,然后我将裁剪的base64值传递给第一个表单。我得到它并从那里保存到数据库(我的意思是一个)。
我尝试过:
$('#frm-insert')。on('submit',function(e){
$(#cropitbaby)。on(on 'submit')
var passdata = $(input#image-data)。val();
$(input#usercropedimage)。val(passdata);
var data = $(this).serialize();
var url = $(this).attr('action');
var post = $(this).attr('method');
e.preventDefault();
$ .ajax({
type:post,
url:url,
data:data,
dataty:'json' ,
成功:函数(数据){
var tr = $('< tr />',{
id:d ata.id
});
tr.append($('< td />',{
text:data.id
}))。append($('< td />', {
text:data.cell_phone
}))。append($('< td />',{
text:data.email
}))。追加($('< td />',{
text:data.created_at_shamsi
}))。append($('< td />',{
text: data.gender
}))。append($('< td />',{
text:data.username
}))。append($('< td />',{
text:data.family
}))。append($('< td />',{
text:data.name
}))。append($('< td />',{
html:'< a href =#class =btn btn-info btn- smid =viewdata-id ='+ data.id +'>تغییررمز< / a>'
+'< a href =#class =btn btn-success btn-smid =editdata-id ='+ data.id +'>ویرایش< / a> '+
'< a href =#class =btn btn-danger btn-smid =deldata-id ='+ data.id +'>حذف< / a> ;'
}));
('#frm-insert')。on('submit',function (e){
(#cropitbaby)。on('submit')
var passdata =
(input#图像数据)VAL();
the problem is i have to run the second form ( submit post it ) . and when it is posted . it fills its values , and i get the value and send the value to the first form . as shown above in the code . and the first one HAS to run first "frm-insert" as shown in the code . it is the one that shows the bootstrap modal ( in which the second multipart/data form is in it ) . and when the main form ( first one is submitted , first it calls the second
form . the second form crops the image , and then i pass the cropped base64 value to the first form . and i get it and save it to the database from there ( i mean form one ) .
What I have tried:
$('#frm-insert').on('submit',function (e) { $("#cropitbaby").on('submit') var passdata = $("input#image-data").val(); $("input#usercropedimage").val(passdata); var data = $(this).serialize(); var url = $(this).attr('action'); var post = $(this).attr('method'); e.preventDefault(); $.ajax({ type:post, url:url, data:data, dataty:'json', success:function (data) { var tr = $('<tr/>',{ id : data.id }); tr.append($('<td/>',{ text:data.id })).append($('<td/>',{ text:data.cell_phone })).append($('<td/>',{ text:data.email })).append($('<td/>',{ text:data.created_at_shamsi })).append($('<td/>',{ text:data.gender })).append($('<td/>',{ text:data.username })).append($('<td/>',{ text:data.family })).append($('<td/>',{ text:data.name })).append($('<td/>',{ html : '<a href="#" class="btn btn-info btn-sm" id="view" data-id="' + data.id + '">تغییر رمز</a> ' + '<a href="#" class="btn btn-success btn-sm" id="edit" data-id="' + data.id + '">ویرایش</a> ' + '<a href="#" class="btn btn-danger btn-sm" id="del" data-id="' + data.id + '">حذف</a>' }));
('#frm-insert').on('submit',function (e) {
("#cropitbaby").on('submit') var passdata =
("input#image-data").val();
这篇关于我可以在另一个form.on('submit')上使用form.on('submit')吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!