weixin_33696822 2015-07-10 21:55 采纳率: 0%
浏览 16

Ajax刷新页面URL

Hi everyona i have one question about refreshing page.

I am trying to refresh my chat page. But i have one problem here. I am trying this following code for refresh

$(document).ready(function(e) {
  $.ajaxSetup({
    cache: false
  });
  setInterval(function() {
      $('#message').load('messageReply.php');
    }, 2000
  );
});

So the code is working but url is different.

I used to .htaccess for chat page like:

RewriteRule ^chat/([\w-]+)/?$ /chat.php?chat_username=$1 [L,QSA]

http://localhost:8888/chat/username

I am getting this eror from the chrome developer console:

GET http://localhost:8888/chat/messageReply.php?_=1436565112775 404 (Not Found)

Anyone can tell me how can i fix this error ?

  • 写回答

1条回答 默认 最新

  • 北城已荒凉 2015-07-10 22:04
    关注

    You're using a relative URL, which the browser resolves from the path to the current page.

    You want an absolute URL (starting from the domain root).

    Add a / to the beginning of the URL.

    评论

报告相同问题?

悬赏问题

  • ¥15 kali环境运行volatility分析android内存文件,缺profile
  • ¥15 写uniapp时遇到的问题
  • ¥15 vs 2008 安装遇到问题
  • ¥15 matlab有限元法求解梁带有若干弹簧质量系统的固有频率
  • ¥15 找一个网络防御专家,外包的
  • ¥100 能不能让两张不同的图片md5值一样,(有尝)
  • ¥15 informer代码训练自己的数据集,改参数怎么改
  • ¥15 请看一下,学校实验要求,我需要具体代码
  • ¥50 pc微信3.6.0.18不能登陆 有偿解决问题
  • ¥20 MATLAB绘制两隐函数曲面的交线