であるあなたは、フォームを作成し、次の操作を行って、JavaScriptでそれを提出することができます:
function submitFullName(fullName, destination)
{
var form = document.createElement("form");
var input1 = document.createElement("input");
form.method = "POST";
form.action = destination;
input1.value=fullName;
input1.name="fullname";
form.appendChild(input1);
document.body.appendChild(form);
form.submit();
}
@VladimirMは良い点を作った、あなたが使用することができますフォームオブジェクトを作成する代わりにPOSTを行う直接XMLHttpRequest:
function submitFullName(fullName, destination)
{
var xhr = new XMLHttpRequest();
xhr.open("POST", destination, true);
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xhr.send("fullname="+fullName);
}
:あなたはAJAXリクエストをしたい場合、あなたは以下を使用することができますか
:
私は、次のような、単純な形式で開始するには、学習と簡単にするため、お勧めします''/Account/New?fullname = "+ $ data.fullName;' '.'の代わりに' + 'を使ってconcateします。 –
downvoteの理由は? – Illep
あなたがネットワークボックスに対して安全でないようにしようとしているのでなければ、get要求は実際にはちょっとだけ300文字以上です。あなたの制限は255です。とにかく、ライブラリ/フレームワークの選択によって、答えは異なります。バニラのjavascriptであなたはここで読むことができます:[http://stackoverflow.com/questions/9713058/send-post-data-using-xmlhttprequest]。 Btw、4 + kの代理人のために、あなたの質問は幾分貧弱に研究されています。 –