jQuery-仅从表单发送一些值 [英] Jquery - Send only some value from a form
本文介绍了jQuery-仅从表单发送一些值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用checkTL()函数,我只需要将输入值发送到服务器(例如),并将其输入到具有"sideon"类的div中.因此,在示例中,我只需要获取(服务器端)inputside0和inputside3的值.这怎么可能? 欢呼
using the checkTL() function, i need to send to the server (for example) only the input value into div with class "sideon". So, in the example, i need to get (server side) only the value of inputside0 and inputside3. How is possible this? cheers
推荐答案
如何使用AJAX?
<form method="POST" action="./index.php?general=example3" name="addtl">
...
</form>
然后:
$(function() {
$('form[name=addtl]').submit(function() {
var dataToPost = $(this).find('.sideon :input').serialize();
$.post(this.action, dataToPost, function(result) {
alert('success');
});
return false;
});
});
当然,将不应该将其值提交给服务器的输入字段放入表单是令人怀疑的.也许您应该重新考虑组织表格的方式.
Of course putting input fields whose values shouldn't be submitted to the server into a form is doubtful. Maybe you should rethink the way you organize the forms.
这篇关于jQuery-仅从表单发送一些值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文