weixin_33701251 2012-07-13 18:04 采纳率: 0%
浏览 76

jQuery AJAX加载方法-延迟

I'll admit that I'm pretty new web development (only been coding for about a year) and especially green when it comes to JS / jQuery.

A specific web page I've built loads different data based on hovering over certain categories: country clubs, resorts, hotels, etc. When I built the site on my local machine, the javascript function was super quick. However, on the live site, it has a long delay before the data swap happens.

The URL is: http://preferredparkingsolutions.com/client_list.html

Which links to a javascript function at: http://preferredparkingsolutions.com/scripts/clientHover.js

Which replaces the display div (#client_list) by pulling data from a text file.

Is there a better / faster way of doing this?

  • 写回答

2条回答 默认 最新

  • weixin_33705053 2012-07-13 18:09
    关注

    Yes, this could be optimised by loading the content in up-front and caching it. Currently you are doing a HTTP request each for each and every hover - even if the user has hovered over that element before, since the AJAX responses aren't being cached. Doing this would be your quickest win.

    However, I can't see any case at all for having the content live externally. Is there any reason you're against having the content physically in the page and just using show/hide methods? There's various benefits to this - SEO, for one thing, since Google will find the content.

    评论

报告相同问题?

悬赏问题

  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥15 请问Lammps做复合材料拉伸模拟,应力应变曲线问题
  • ¥30 python代码,帮调试
  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿