$.post
こんにちは、Javascript のメソッドを使用して、スペース バーが押されたときにライブ テキスト フィールドから別のスクリプトにデータを送信するページを作成しようとしています。index.phpとして知られるページのデータを、save.phpという別のファイルを介して投稿したいと考えています。txt_a
textfield の値を post 変数の値にしたいtext
。どうすればいいですか?以下はこれまでの私のコードです...
<html>
<head>
<script type="text/javascript">
function event_a() {
if (event.keyCode == 13) {
$(document).ready(function(){
txt=$document.getElementsByName('txt_a')[0].value;
$.post("save.php",{text:txt});
};
};
}
</script>
</head>
<body>
<form method="POST" name="" action="">
<input name="txt_a" type="text" id="txt_a" onkeypress="event_a()"/>
</form>
</body>
</html>
ありがとう