我可以在第二个表单提交后填充隐藏的div。第一次提交后出现错误。为什么?使用jQuery Form Plugin。任何的想法?感谢。
$(document).ready(function() {
// get ID from the form name:
$('form').submit(function(e){
targetNum = this.name;
// call processing page:
$('#formTarget' + targetNum).ajaxForm({
// populate DIV
target: '#divTarget' + targetNum,
success: function() {
$('#divTarget' + targetNum).fadeIn('slow');
}
});
});
});
<div id='divTarget1'></div>
<form id='formTarget1' name='1' action='process2.asp' method='post'>
<input type='hidden' name='MapaID' value='1'>
<input type='submit' value='OK'>
</form>
<div id='divTarget2'></div>
<form id='formTarget2' name='2' action='process2.asp' method='post'>
<input type='hidden' name='MapaID' value='2'>
<input type='submit' value='OK'>
</form>
<div id='divTarget3'></div>
<form id='formTarget3' name='3' action='process2.asp' method='post'>
<input type='hidden' name='MapaID' value='3'>
<input type='submit' value='OK'>
</form>
答案 0 :(得分:0)
试试这个:
$(document).ready(function() {
$(':submit').click(function(e) {
targetNum = $('form').has(this).prop('name');
$('#formTarget' + targetNum).ajaxForm({
target: '#divTarget' + targetNum,
success: function() {
$('#divTarget' + targetNum).fadeIn('slow');
}
});
return false;
});
});
答案 1 :(得分:0)
您可以使用.load()
方法。