gpt4 book ai didi

jquery - 未捕获的类型错误 : Property 'submit' of object # is not a function

转载 作者:行者123 更新时间:2023-12-01 06:12:36 25 4
gpt4 key购买 nike

类型设置为“提交”,但仍然不起作用。我正在使用 console.log 但它不显示任何内容。我希望控制台日志显示一个数字(两个通过 ajax 添加在一起)

我该如何解决这个问题?

Jquery 代码:

jQuery(document).ready( function($) {
(function($) {
$(document).ready(function(){
$('#formsubmit').submit(function(){
$.post(
PT_Ajax.ajaxurl,
{
action : 'ajax-inputtitleSubmit',
noofwelds : $('input[name=numberofwelds]').val(),
noofconwelds : $('input[name=numberofconwelds]').val(),
nextNonce : PT_Ajax.nextNonce
},
function( response ) {
console.log( response );
}
);
return false;
});

});
})(jQuery);
});

表单

<form action="" method="post" type="submit" name="formsubmit" id="formsubmit"   >
<h1> Process </h1>
<p> operation type always robot </p>
<br> <br>
Number of welds: <input type="number" name="numberofwelds" id="numberofwelds" >
<br> <br>
Number of construction welds: <input type="number" name="numberofconwelds" id="numberofconwelds" >
<br> <br>
Total one: <input type="text" name="totalone" id="totalone" disabled>
<div id="totalfail1"></div>
<br> <br>
Total two: <input type="text" name="totaltwo" id="totaltwo" disabled>
<div id="totalfail2"></div>
<br> <br> <br> <br>
Total three: <input type="text" name="totalthree" id="totalthree" disabled>
<div id="totalfail3"></div>
<br> <br> <br> <br>
<input type="submit" value="Calculate" id="formsubmit" name="submit" class="ajax-link" >
<div id="result"> </div>
</form>

最佳答案

这是因为您的表单中有一个名为 submitinput 元素,请重命名它

<input type="submit"  value="Calculate" id="formsubmit" name="formsubmit" class="ajax-link" >

关于jquery - 未捕获的类型错误 : Property 'submit' of object #<HTMLFormElement> is not a function,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22478182/

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