另一个IE jQuery AJAX/发布问题 [英] Another IE jQuery AJAX/post problem

查看:72
本文介绍了另一个IE jQuery AJAX/发布问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,所以我有这个网站, http://www.leinstein.dk .

OK so i have this website, http://www.leinstein.dk.

您将看到"Hello World!"这是来自ok.php的,我创建了一个脚本,该脚本会在10秒钟后刷新ok.php.无论如何,这不会在IE中显示. 我不知道为什么,希望您能帮助我.

You will see "Hello World!" This is from ok.php, ive made a script that refreshes ok.php after 10 seconds. Anyways, This does not show in IE. I dont know why, and i hope you can help me out.

这是我的脚本:

function ajax_update()
{
      cache: false
 /* var wrapperId  = '#wtf'; */
 var postFile = 'ok.php';
    $.post("ok.php", function(data){
 cache: false
          $("#wtf").html(data);
      });  
 setTimeout('ajax_update()', 10000);

}   

这是index.php:

And here's index.php:

<?
header("cache-control: no-cache");
?>
<html>
<head>
<link href="style.css" type="text/css" rel="stylesheet" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script src="ajax_framework.js" language="javascript" charset="UTF-8"></script>
</head>
<!-- AJAX UPDATE COMMENTS BEGIN -->
<body onload="ajax_update();">
<!-- AJAX UPDATE END -->
<br>

<div id="wtf"></div>
</body>
</html>

谢谢你..!

推荐答案

您不能仅将cache: false放在整个代码中的随机位置.在开始编写代码之前,请学习基本的Javascript 语法.通过遵循基础教程,您可能会学到更多的知识,而不是在StackOverflow上发布一堆本地化的问题.

You can't just put cache: false throughout your code in random spots. Please learn basic Javascript syntax before starting to write code. You'll probably learn much more by following a basic tutorial than posting a bunch of localized questions here on StackOverflow.

但是,我将向您展示这次 的功能.但我强烈建议您阅读我提供的链接的教程.

I will, however, show you what your function should look like this time. But I strongly recommend reading the tutorial that I have provided a link to.

function ajax_update()  { 
  $.post("ok.php", function(data){ 
    $("#wtf").html(data); 
    setTimeout(ajax_update, 10000);
  });
}    

这篇关于另一个IE jQuery AJAX/发布问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆