重複の可能性:
jquery を使用してフォームと変数を一緒に送信する
次のコードを使用して、ajax、jquery を介してフォーム データをサーバーに送信しています。
// this is the id of the submit button
$("#submitButtonId").click(function() {
var url = "path/to/your/script.php"; // the script where you handle the form input.
$.ajax({
type: "POST",
url: url,
data: $("#idForm").serialize(), // serializes the form's elements.
success: function(data)
{
alert(data); // show response from the php script.
}
});
return false; // avoid to execute the actual submit of the form.
});
投稿フォームのデータ以外に独自のパラメーター/値を送信する必要がある場合、どうすればよいですか? ありがとう。