需要帮助,2提交表单在1 ajax发送后1个文件
need help, 2 submit forms in 1 ajax send post to 1 file.php
你好,我需要使用单一ajax或jquery发布2个表单到1个公共文件,我的代码是这个
<form id="filter-group1" class="form" target="remember" autocomplete="on" method="post">
<input pattern="[0-9]*" value="" name="ch1" maxlength="10" size="10" autofocus="" autocorrect="off" id="client-nbr" class="form-control numeric" rv-value-reactive="form.idTelematique" type="tel">
<a class="reset-input" href="#" id="initClient" onclick="change()"></a>
<input value="" id="memoriser" name="memoriser" type="checkbox">
<button type="submit" id="remember_button" class="hidden"></button>
</form>
<form id="filter-group2" method="post" class="form">
<div class="field-password">
<input rv-value="form.password | starPassword" readonly="" maxlength="6" name="staredPassword" id="secret-nbr" class="form-control" type="password">
<a class="reset-input" href="#" id="initPass" onclick="change1()"></a>
</div>
</form>
<div class="cell-password">
<div class="field-valid">
<button type="button" href="#" class="btn-primary btn-block" onclick="filterBy()" id="submitIdent" rv-text="config.app.identification.boutonTitle" >submit</button>
</div>
</div>
JS
function filterBy() {
// Construct data string
var dataString = $("#filter-group1, #filter-group2").serialize();
// Log in console so you can see the final serialized data sent to AJAX
console.log(dataString);
// Do AJAX
$.ajax( {
type: 'POST',
url: 'filter.php',
data: dataString,
success: function(data) {
console.log(data);
$('#message').html(data);
}
});
}
<button type="button"
需要提交2个表单使用ajax张贴在单一文件php
问题没有解决,让我一个完整的脚本,如果你不能,当我试图点击<button type="button" href="#" class="btn-primary btn-block" onclick="filterBy()"
功能不执行
创建数据字符串:
var dataString = {
frm1 : $("#filter-group1").serialize(),
frm2 : $("#filter-group2").serialize()
};
和在php端你可以得到的值与键frm1, frm2
。
相关文章:
- Ajax文件加载和<输入>文件加载
- AJAX文件上传与PHP验证
- 如何在ajax文件上传中添加额外的POST参数
- Ajax文件上传Vue.js
- ajax文件上传图片获取高度和宽度
- Rails和ajax文件上传-无法读取属性'innerHTML'的空错误
- 没有办法显示“;上传面板”;,没有“;文件面板”;在ITHit AJAX文件浏览器中可见
- Laravel 5 ajax文件上传
- AJAX文件上传到php,没有发送任何内容
- AJAX文件上传/表单提交,无需jquery或iframes
- 我的AJAX文件不起作用
- Valum's Ajax文件上传器-绑定到给定类的所有元素
- JSON响应一直未定义(ajax文件上传)
- 如何在 AJAX 文件上传后更新页面
- 如何输出反向顺序?AJAX 文件 > DIV.
- jquery ajax 文件上传,成功不被调用
- 将带有 php 和 javascript 变量的 php 文件包含在 ajax 文件中
- 如何在没有jQuery或iframe或flash的情况下为IE7 / 8制作AJAX文件上传器
- Jquery/ajax 文件上传
- jQuery Ajax 文件获取问题