简体   繁体   English

ajax请求后发送带有jquery和ajax的表单

[英]sending form with jquery and ajax after ajax request

hy i've got a tricky problem. 嗨,我有一个棘手的问题。 i have a form like 我有这样的形式

<form name="myform" id="myform" method="post">
<div id="box1">
<select name="sel1" id="sel1">...</select>
<select name="sel2" id="sel2">...</select>
</div>
<input type="submit" name="send" id="send">

Than i have a function which read the values of the select inputs, create a new select and rebuild the div box1. 我拥有一个读取选择输入值,创建新选择并重建div box1的功能。

So after all its like 所以毕竟

<select name="sel1" id="sel1">...</select>
<select name="sel2" id="sel2">...</select>
<select name="sel3" id="sel3">...</select>
<select name="sel4" id="sel4">...</select>

if i hit the submit button it will send all things from the form, except the things from the div box. 如果我点击了提交按钮,它将发送表单中的所有内容,但div框中的内容除外。

what could be the problem? 可能是什么问题呢?

if i dont recreate the div it works fine, but i want to add select inputs after one selection is made. 如果我不重新创建div,它可以正常工作,但是我想在做出一个选择之后添加选择输入。

there is a loop which counts the name's and add one more. 有一个循环计算名称,然后再添加一个。

thx 谢谢

Your problem is multiple selects with the same ID. 您的问题是具有相同ID的多项选择。

<select name="sel1" id="sel1">...</select>
<select name="sel2" id="sel2">...</select>
<select name="sel3" id="sel1">...</select>
<select name="sel4" id="sel2">...</select>

Should be 应该

<select name="sel1" id="sel1">...</select>
<select name="sel2" id="sel2">...</select>
<select name="sel3" id="sel3">...</select> <!-- sel3 -->
<select name="sel4" id="sel4">...</select> <!-- sel4 -->

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM