gpt4 book ai didi

javascript - 将数据ajax发送到php

转载 作者:行者123 更新时间:2023-12-03 11:59:51 24 4
gpt4 key购买 nike

我想在点击删除时发布该值。请检查错误

$.ajax({
type: "POST",
var checkid = $('#delete').click(function(){ $(this).val();});,
url: "survey-command.php",
data: { checkid: checkid, }
}).done(function( msg ) {
alert( "Data Saved: " + msg );
});

我不知道如何将值传递给这个 checkid 变量

最佳答案

我认为你的代码应该如下所示:

$('#delete').click(function(){
var checkid= $(this).val(); //assuming $('#delete') is an input.
// otherwise use $('#delete').html();
$.ajax({
type: "POST",
url: "survey-command.php",
data: { checkid: checkid, }
}).done(function( msg ) {
alert( "Data Saved: " + msg );
});
});

关于javascript - 将数据ajax发送到php,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25462097/

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