我有一个表单,这里是提交按钮的处理程序:
这个处理程序基本上预处理一些数据并将其发送到一个隐藏表单中,如下所示:
问题是请求没有命中隐藏表单中定义的端点。我在这里做错了什么?
我已经更改为将输入类型更改为隐藏,而不是表单。提交处理程序肯定会执行,并且使用FireBug,我在NET选项卡下看不到请求发送出去。
我正在使用这个虚拟数据来尝试触发请求,但它仍然没有起作用:
$( '#submit_btn' ).click( function( data ){
theForm = document.getElementById( 'realForm' );
theForm.meetingName.value = document.getElementById( 'meeting_name' ).value;
theForm.meetingId.value = '';
theForm.description.value = document.getElementById( 'mtg_description' ).value;
theForm.startTime.value = startDate + ' ' + startTime;
theForm.endTime.value = endDate + ' ' + endTime;
theForm.loginName.value = participants;
theForm.role.value = roles;
theForm.docRights.value = docRights;
theForm.submit();
});
这个处理程序基本上预处理一些数据并将其发送到一个隐藏表单中,如下所示:
<form id="realForm" style="visibility:hidden" action="/app/meeting/create" method="post">
<input name="loginName" type="text">
<input name="meetingName" type="text">
<input name="meetingId" type="text">
<input name="startTime" type="text">
<input name="endTime" type="text">
<input name="description" type="text">
<input name="roles" type="text">
<input name="docRights" type="text">
</form>
问题是请求没有命中隐藏表单中定义的端点。我在这里做错了什么?
我已经更改为将输入类型更改为隐藏,而不是表单。提交处理程序肯定会执行,并且使用FireBug,我在NET选项卡下看不到请求发送出去。
我正在使用这个虚拟数据来尝试触发请求,但它仍然没有起作用:
theForm.meetingName.value = "MY MTG";
theForm.meetingId.value = '';
theForm.description.value = "DESC";
theForm.startTime.value = "2013-05-25 00:00:00";
theForm.endTime.value = "2013-05-25 02:00:00";
theForm.loginName.value = "foo@frr.com";
theForm.role.value = "M,M";
theForm.docRights.value = "CRUT,CRUT";
visibility:hidden
看看是否能工作吗?另外,也许可以尝试使用 'display:none' 而不是 'visibility:hidden'。 - Adam Plocher