私はフォームとajaxを持っています。フォームでボタンの値を送信する方法
私は、フォームにボタンの値を送信するにはどうすればよい$(form).serialize();
に送信することはできませんか?
HTML:
<form action="" id="ogrenci_arama_formu">
<input type="text" id="eposta" name="eposta">
<button id="ogrenci_ara" name="ogrenci_ara" value="true" class="btn btn-info">Öğrenciyi Ara</button>
<!--<input id="ogrenci_ara" type="hidden" name="ogrenci_ara" value="true">-->
</form>
はAJAX:
$("#ogrenci_arama_formu").submit(function (e) {
e.preventDefault();
console.log("form: ",$(this).serialize());
$.ajax({
url: "sayfalar/ogrenci_bilgileri.php",
type: 'post',
/*dataType: 'json',*/
data: $(this).serialize()
}).done(function(data) {
$("tbody").html(data);
}).fail(function(data) {
console.log("error",data);
});
});
出力:
eposta=
なぜボタン値が必要ですか?私は2つのボタンを使用しているので –
。名前付き検索ボタン、名前付きExcelエクスポートボタン。 – bukalemun