コーディングに問題があるため、Firefox では正常に動作しますが、IE9 では最初の ~5 秒間しか動作しません。その後、POST データを受信しなくなりました。
フォーム入力の値を POST 変数として使用して、AJAX 経由で PHP ページをロードしたいと考えています。最初の 5 秒間は、要求されたページで POST を受け取ることができますが、その後は空の文字列しか受け取りません。
ここに私のコードがあります:
function reload_form(){
var data = $("#formularfelder").serialize()
$.ajax({
type: 'POST',
url: 'content/formular.php',
data: data,
success: function(msg) {
$("#form_container").html(msg);
}
});
}
これは IE9 のバグですか?回避策はありますか?
あなたが私を助けることができれば、それは素晴らしいことです!:)
******編集****
この投稿でこの問題の理由を見つけました:
Internet Explorer が失敗後に Ajax 呼び出しで HTTP 投稿本文を送信しないのはなぜですか?
IE はキープアライブ タイムアウトになり、POST データ内で本文を送信しなくなります。
To workaround this problem I send a packet in regular time intervalls (equal to the keep-alive timeout) to the server to keep the keep-alive. This will cause a little bit traffic (~200 Bytes per refresh) but it's still a more practicable workaround then disabling the keep-alive in Apache.
This was the only solution I found for this problem
For someone with the same problem here's my refreshing Code for a keep-alive timeout of 5 seconds:
var updateDiv = function ()
{
$.ajax({type: 'POST', url: 'timeout.php'});
yourTimer = window.setTimeout(updateDiv, 5000);
}
$( document ).ready(function() {
var yourTimer = window.setTimeout(updateDiv, 5000);
});