JavaScript序列化无法正常工作
我目前正在尝试将ajax与jQuery结合使用,但有一行代码不想工作。我将在下面显示收到的错误: TypeError:$(…)。searialize不是一个函数 出现错误的行是:JavaScript序列化无法正常工作,javascript,jquery,ajax,Javascript,Jquery,Ajax,我目前正在尝试将ajax与jQuery结合使用,但有一行代码不想工作。我将在下面显示收到的错误: TypeError:$(…)。searialize不是一个函数 出现错误的行是: var info = $(this).searialize(); 这是代码: $(document).ready(function() { $("#SearchField").submit(function(e) { e.preventDefault(); // grabs all
var info = $(this).searialize();
这是代码:
$(document).ready(function() {
$("#SearchField").submit(function(e) {
e.preventDefault();
// grabs all post variables in the form
var info = $(this).searialize();
$.post('dictionary.php', info, function(data) {
$('.DictionaryContentWrapper').append(data);
});
// prevent server from refreshing page
return false;
});
});
拼写为“序列化”。试试看=DIt实际上是
.serialize()
,而不是.searialize()
?应该是serialize(),而不是searialize(),就像你在标题页中拼写的那样,我拼写错了:P
$(document).ready(function() {
$("#SearchField").submit(function(e) {
e.preventDefault();
// grabs all post variables in the form
var info = $(this).serialize(); //not searialize
$.post('dictionary.php', info, function(data) {
$('.DictionaryContentWrapper').append(data);
});
// prevent server from refreshing page
return false;
});
});