gpt4 book ai didi

javascript - Onload 提交不起作用

转载 作者:行者123 更新时间:2023-11-28 15:26:28 26 4
gpt4 key购买 nike

我正在尝试在页面加载时提交此表单。但由于某种原因它不起作用。我检查了控制台是否有错误,似乎没有任何问题。

这是html加javascript(添加了jquery)

<script type="text/javascript">
$(document).ready(function() {
$('#new-ticket-form').submit();
});
</script>

<form id="new-ticket-form" action="/contact_form.html" method="post" name = "new-ticket-form" >
<input type="hidden" name="MAX_FILE_SIZE" value="100000000">
<input type="hidden" name="fullname" value="JOhnny test'">
<input type="hidden" name="order_num" value="123456">
<input type="hidden" name="phone" value="347-489-4874">
<input type="hidden" name="email" value="fake123@gmail.com">
<input type="hidden" name="fromorderpage" value="yes">
<input type="hidden" name="submit" value="Submit">
<table>
<tr>
<td class="label">
New Ticket Subject:
</td>
<td class="field">
<select name="subject_id">
<option value="0">Select one ...</option>';
<option value="123">Confirm Delivery Appointment</option>';
<option value="124"> Reschedule Delivery Appointment</option>
</select>
</td>
</tr>
<tr>
<td class="label">
Summary:
</td>
<td class="field">
<input type="text" name="summary" value="This is a test disregard">
</td>
</tr>
<tr>
<td class="label">
Your Message:
</td>
<td class="field">
<textarea name="usr_msg" placeholder = "This is a test disregard">This is a test disregard</textarea>
</td>
</tr>

<tr>
<td class="submit" colspan="2"><input type="submit" value="Submit Ticket" name = "btn_submit">
</td>
</tr>
</table>
</form>

最佳答案

删除隐藏的输入字段<input type="hidden" name="submit" value="Submit"> - 然后就可以了。

工作中的 jsFiddle: http://jsfiddle.net/3bo4rgvw/3/

关于javascript - Onload 提交不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28774372/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com