开发者

jQuery AJAX / CakePHP Load content/sections

I have seen on my web apps such as Twitter and Flow that they load and show the different sections using urls like /#!/section

My understanding is that by having the #! prefix the url it prevents the page from being directly loaded and instead uses JavaScript to load in the content. Can anyone show an example of this? I have been putting together a CakePHP app that I would like to incorporate a similar func开发者_运维技巧tionality for learning purposes but haven't seen any examples of how to do it...

Any help much appreciated. Thanks

EDIT: I also wish to show a loading image when the content is brought through that is reflective of the content size e.g. if it is loading 20 images that would take 10 seconds then the spinner would show for 10 seconds etc.

THANKS


Since you're using jQuery already, have a look at jQuery BBQ, that will do the heavy lifting of dealing with the URL fragment for you. You might want to have a look at Sammy.js too. Both libraries have lots of examples available and both will deal with the cross-browser issues.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜