jquery serialize and $.post

前端 未结 7 908
独厮守ぢ
独厮守ぢ 2020-12-01 12:32

I\'m trying to send a lot of data from a form using the $.post method in jQuery. I\'ve used the serialize() function first to make all the form data into one long string whi

7条回答
  •  旧巷少年郎
    2020-12-01 12:52

    What leads you to believe that the data is appended to the URL?

    Anyway, wouldn't it make more sense to pass the form values in the form data itself? It will allow you to skip the "explode" step:

    $("#addShowFormSubmit")
      .click(function() { 
          var perfTimes = $("#addShowForm").serialize(); 
          $.post("includes/add_show.php", 
             $.param({name: $("#showTitle").val()}) + "&" + perfTimes, 
             function(data) {...}); 
      });
    

提交回复
热议问题