gpt4 book ai didi

jquery - 类型错误 : 'stepUp' called on an object that does not implement interface HTMLInputElement

转载 作者:行者123 更新时间:2023-11-29 15:48:01 25 4
gpt4 key购买 nike

我在使用 AJAX 时遇到错误:

TypeError: 'stepUp' called on an object that does not implement interface HTMLInputElement....plete",[C,p]),--x.active||x.event.trigger("ajaxStop")))}return C},getJSON:functi...

这是我使用它的代码部分:

<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>

这是我的 JavaScript 代码,适用于我之前定义的复选框:

function feedback() {
var boxes = document.getElementsByClassName('box');
for (var j = 0; j < boxes.length; j++) {
if (boxes[j].checked) {
//assign(1);
assign = 1;
} else {
assign = 0;
//assign(0);
}
var wordid = document.getElementsByClassName('wordId')[j];
$.ajax({
url: "assigner.php",
type: "POST",
data: {
wordid: wordid,
assign: assign
}
}).done(function(e) {
/*alert( "word was saved" + e );*/
});
}
}

我尝试了这个,但它不起作用,也没有给我任何错误。

var newvalue = '';
$('input[name=wordid\\[\\]]').each(function(index, element) {
newvalue = newvalue + this.value + ',';
});
$.ajax({
url: "assigner.php",
type: "POST",
data: {
wordid: newvalue,
assign: assign
}
}).done(function(e) {
/*alert( "word was saved" + e );*/
});

最佳答案

$.ajax 并不期望您传递给 data 的对象中存在 HTMLInputElement 类型的 DOMElement。尝试只给它字段的值:

var wordid = $('.wordId').val();
$.ajax({
url: "assigner.php",
type: "POST",
data: { wordid: wordid, assign: assign}
}).done(function( e ) {
/*alert( "word was saved" + e );*/
});

关于jquery - 类型错误 : 'stepUp' called on an object that does not implement interface HTMLInputElement,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56935969/

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