【发布时间】:2011-12-22 21:44:47
【问题描述】:
好的,所以我在我的网站的首页上有三个表单,我不是最好的 jquery 选择器或 .each 函数....所以我将 j 查询 ui 按钮链接到发送 ajax 的事件侦听器发布但问题是我不能只指定我想要的形式!这是我的代码
<form>
fields......
fields......
fields......
fields......
<button>register</button>
</form>
<form>
fields......
fields......
fields......
fields......
fields......
<button>login</button>
</form>
<form>
fields......
fields......
fields......
fields......
fields......
<button>book</button>
</form>
$(function(){
$('button').click(function(event) {
$('form .... i wanna hide all forms once clicked .. working!!!').hide();
event.preventDefault();
$('pload').html('<img src="source/image/lbl.gif">');
// heres where i get the data from all forms i just want one....
var page = 'form.'+$('form').serialize();
var huh = $('input:hidden').val();
var data = 'pop='+huh+'&page='+page;
$.post('source/php/bots/authorize.php',data,function(data){
$('#pager_master_div').html(data);
$('pload').html('');
});
});
});
【问题讨论】:
标签: jquery jquery-ui button jquery-selectors