私は次のフォームを持っています、
<form action="localhost/xyz.aspx" method = "post" enctype="multipart/form-data">
<input type="text" name="name">
<input type="text" name="age">
<input type="text" name="submit">
</form>
AJAX & jQuery
私の要件は、html に明示的に追加されたフォーム タグを使用して、または使用せずにアクションを完了することです。
ティア
アップデート1
私が試してみました
function onButtonClicked()
{
$.ajax({
type: 'POST',
url: "xyz.aspx",
data : {"name" : "john", "age" : "22"},
crossDomain : true,
beforeSend: function (x) {
if (x && x.overrideMimeType) {
x.overrideMimeType("multipart/form-data");
}
},
success: function(data){
alert("Success");
},
error: function(data){
alert("on start process error");
}
});
}
sample.html
<html>
<body>
<input type="button" onclick = "onButtonClicked()">
</body>
</html>
Unsupported Media Type 415 を返します。
ajaxを使ってフォームデータを送信したい