html 没有数据显示,html-如果输入标签没有名称,表单数据是否仍在传输?

它不会直接起作用,但是您可以通过JavaScript中的AJAX调用来分配它们,idk真的知道它在现实世界中是否真的有任何应用程序(可能是服务器期望的参数混淆了)

要处理的JS是(使用jQuery处理ajax)

$("#login").on("submit",function(ev){

$.post("someurl",{

usrn: $("#username").val,

pwd: $("#password").val

},function(ev){

//this is the callback function that runs when the call is completed successfully

});

}

/*second argument on $.post is and object with data to send in a post request

usrn would be the name of the parameter recived in the server

same for pwd "#username" and "#password" are the id's html attribute for the field

'.val' is the jquery object's attribute in which jquery access the value in the text box

"$()" or it's equivalent "jQuery()" works like an object constructor that fills

the attributes with the

DOM data that cover the css selector that this function expects as a parameter*/

请注意,由于我尚未测试代码,因此代码可能并不完全正确,但其背后的逻辑应该是不言自明的

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值