jQuery提交表单,然后在现有的div中显示结果

jQuery提交表单,然后在现有的div中显示结果,第1张

jQuery提交表单,然后在现有的div中显示结果

此代码应该做到这一点。您不需要Form插件来完成以下 *** 作:

$('#create').submit(function() { // catch the form's submit event    $.ajax({ // create an AJAX call...        data: $(this).serialize(), // get the form data        type: $(this).attr('method'), // GET or POST        url: $(this).attr('action'), // the file to call        success: function(response) { // on success.. $('#created').html(response); // update the DIV        }    });    return false; // cancel original event to prevent form submitting});


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zaji/5566506.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-12-14
下一篇2022-12-14

发表评论

登录后才能评论

评论列表(0条)

    保存