有一个表单,在提交时,我将其转换为序列化字符串,以便通过 ajax 提交表单。
var data = $$.serialize();
现在有一个名为“title”的输入字段,我想获取它的值以显示一条消息。所以我正在寻找一种方法来做到这一点。我试过了;
alert(data.name);
但是发现不是这个方法。
更新
这是 fiddle :http://jsfiddle.net/wHBYK/
最佳答案
您根本不需要 jQuery。只需这样做:
$('#frmEditTab').submit(function(e){
e.preventDefault();
var title = this.title; //get the input named "title" of the form
alert(title.value); //alerts the value of that input
});
关于javascript - 从序列化字符串中获取值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16776858/