Html 如何使用表单发送按钮值

Html 如何使用表单发送按钮值,html,ajax,Html,Ajax,我有一个表单和ajax 我无法使用$(表单).serialize()发送 如何将按钮值与表单一起发送 html: 输出: eposta= 尝试将按钮值存储到一个变量中,并使用如下形式序列化发送 JAVASCRIPT- $("#ogrenci_arama_formu").submit(function(e) { e.preventDefault(); var btnValue = $(this).find('#ogrenci_ara').val(); console.log("for

我有一个表单和ajax

我无法使用
$(表单).serialize()发送

如何将按钮值与表单一起发送

html:

输出:

eposta=

尝试将按钮值存储到一个变量中,并使用如下形式序列化发送

JAVASCRIPT-

$("#ogrenci_arama_formu").submit(function(e) {
  e.preventDefault();
  var btnValue = $(this).find('#ogrenci_ara').val();
  console.log("form: ", $(this).serialize()+'&ogrenci_ara='+btnValue);
  $.ajax({
    url: "sayfalar/ogrenci_bilgileri.php",
    type: 'post',
    /*dataType: 'json',*/
    data: $(this).serialize()+'&ogrenci_ara='+btnValue
  }).done(function(data) {
    $("tbody").html(data);
  }).fail(function(data) {
    console.log("error", data);
  });
});

为什么需要按钮值?因为我使用两个按钮。一个命名的搜索按钮,一个命名的excel导出按钮。因为只有“成功的控件”被序列化为字符串,所以没有任何提交按钮值被序列化,因为表单不是使用按钮提交的。您可以从链接中阅读有关
serialize()
方法的更多信息。谢谢,我理解了
eposta=
$("#ogrenci_arama_formu").submit(function(e) {
  e.preventDefault();
  var btnValue = $(this).find('#ogrenci_ara').val();
  console.log("form: ", $(this).serialize()+'&ogrenci_ara='+btnValue);
  $.ajax({
    url: "sayfalar/ogrenci_bilgileri.php",
    type: 'post',
    /*dataType: 'json',*/
    data: $(this).serialize()+'&ogrenci_ara='+btnValue
  }).done(function(data) {
    $("tbody").html(data);
  }).fail(function(data) {
    console.log("error", data);
  });
});