ajax textfield,php - jQuery ajax upon updating textfield cant change textfield again - Stack Overflo...

在Fleet.php中定义的sendData函数遇到一个问题:首次更改文本字段的值时,能正确发送数据到FleetData.php并更新div内容。然而,之后再次更改文本字段的值,数据不再发送到FleetData.php。这个问题不适用于select字段。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

I am an bit lost on the following thing.

I have this piece of code,

Fleet.php

function sendData(nr) {

var data = $("#myform" + nr).serialize();

console.log(data);

$("#myForm" + nr).submit(function(event){

event.preventDefault();

});

jQuery.ajax({

url: "inc/FleetData.php",

datatype: "html",

type: "POST",

data: data,

success:function(data)

{

if(data) {

//$("#fleet").load(window.location + " #fleet");

$('#fleet').html(data);

//alert(data);

} else {

//$("#fleet").load(window.location + " #container");

//alert("Something is wrong with the update of the collor. Please notify an admin");

//alert(data);

}

}

});

}

the form

Now for the first time I change the value it will post the values to fleetData.php,

then it will load the div.

After that I can change the value but it will not send the data to fleetData.php,

this is only happening with textfields and not with select fields.

Edit:

Select Fields

Red

Blue

Green

Purple

Yellow

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值