使用jQuery的AJAX请求不发布表单数据
|
我正在尝试创建一个搜索表单,该表单发布从MySQL数据库查询的结果,但是遇到了麻烦。该查询正在正确运行,但是在我的表单字段中输入的信息没有\'posting \'到php文档中并且实际上无法通过
<form name=\"IDsearchform\" action=\"\">
<input class=\'required digits\' type=\"text\" value=\"\" maxlength=\'8\' minlength=\'8\' name=\"term\" id=\"search\" />
</form>
$(document).ready(function(){
//show loading bar
function showLoader(){
$(\'.search-background\').fadeIn(200);
}
//hide loading bar
function hideLoader(){
$(\'#sub_cont\').fadeIn(1500);
$(\'.search-background\').fadeOut(200);
};
$(\'#search\').keyup(function(e) {
if(e.keyCode == 13) {
showLoader();
$(\'#sub_cont\').fadeIn(1500);
$(\"#content #sub_cont\").load(\"<?php bloginfo(\'template_directory\'); ?>/searchID.php\", hideLoader());
}
});
$(\".searchBtn\").click(function(){
//show the loading bar
showLoader();
$(\'#sub_cont\').fadeIn(1500);
$(\"#content #sub_cont\").load(\"<?php bloginfo(\'template_directory\'); ?>/searchID.php\", hideLoader());
});
});
没有找到相关结果
已邀请:
2 个回复
窝头菊
首先,包含数据很重要。 ;-)其次,您要确保数据是一个对象,以便jquery将执行POST而不是GET。 资源
细屠截殴些
这样,您的表单发布数据将自动发送给我的jQuery。