使用することをお勧めしますajax()
このようなもの:
$.ajax({
type: "POST",
url: "post.asp",
data: { update2: firstname } //you can add more values in here if you need
}).done(function( msg ) {
alert( "Data Saved: " + msg );
});
ajax() 呼び出しが完了すると、Done がトリガーされます。
このコードが意図したとおりに実行されているかどうかを確認する必要がある場合は、次のようにすることができます。
$.ajax({
type: "POST",
url: "post.asp",
data: { update2: firstname }, //you can add more values in here if you need
cache: false,
success: function(response)
{alert(response);}
}).done(function( msg ) {
alert( "Data Saved: " + msg );
});
編集:
投稿するだけの場合は、次のようなものを使用できます。
$.post("test.php", { name: "John", time: "2pm" }).done(function(data) { alert("Data loaded: " + data);});