📌  相关文章
📜  Laravel ajax 表单提交 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:06.727000             🧑  作者: Mango

代码示例1
$('#comment').on('submit', function(e) {
       e.preventDefault(); 
       var name = $('#name').val();
       var message = $('#message').val();
       var postid = $('#post_id').val();
       $.ajax({
           type: "POST",
           url: host+'/comment/add',
           data: {name:name, message:message, post_id:postid}
           success: function( msg ) {
               alert( msg );
           }
       });
   });