当用户点击一个链接时,我会弹出一个模态弹出窗口,上面有一个提交给php脚本的表单。我希望php脚本输出填充模式弹出窗口(本质上是一个div)。同时,我想提交一个表单,这是模式弹出式表单。我想使用ajax,这就是我到目前为止所拥有的:
$('.window .submitlink').click(function (e) {
/* Form 1 */
$('#form2').live('submit', function() {
$(this).ajaxSubmit({
target: '#dialog',
url: 'signincode.php'
});
return false;
});
/* Form 2 */
$('#form1').live('submit', function() {
$(this).ajaxSubmit({
//target: '#divLookup',
url: 'index.php',
});
return false;
}); }); 我好像不能让它起作用。有什么想法吗?
谢谢你的帮助
雷蒙娜
发布于 2011-12-10 12:18:41
您需要使用specify a success parameter to the ajax command来更新DOM元素。基本上,从php函数返回更新DOM所需的数据,并使用这些数据通过jQuery更改DOM。
$(this).ajax({
//target: '#divLookup',
url: 'index.php',
success: function(data) {
// use the stuff contained in 'data' (which is just everything returned
// from the php script, and visible in Firebug) to modify DOM elements
}
});https://stackoverflow.com/questions/8453819
复制相似问题