开发者

jquery link problem?

开发者 https://www.devze.com 2023-03-22 14:58 出处:网络
when a user clicks a link on the site, instead of loading a whole other page jquery just loads the content into the content div in the middle of the page, but when a user direct links to a page it doe

when a user clicks a link on the site, instead of loading a whole other page jquery just loads the content into the content div in the middle of the page, but when a user direct links to a page it does not do this is there a way to make this happen when a user direct links to a page

www.scotwebtech.co.uk and navigate to aboutus ( how i want it to look)

http://www.scotwebtech.co.uk/aboutus开发者_如何学Go.html (how it looks when a user direct links)


actually the user should directly link to http://www.scotwebtech.co.uk/#aboutus.html and not http://www.scotwebtech.co.uk/aboutus.html

change the links pointing to http://www.scotwebtech.co.uk/aboutus.html to include the # character.


Other solutions:

1 . Design the "about us" page in the same way as your other pages, then use jQuery's load() method to extract the content you are looking for

$('#result').load('ajax/test.html #container');

Not the best way though, since you are still loading a lot of html that you do not need, but it should work.

2 . Depending on your will to use a script language on your server you could let a script decide if to deliver the complete page (on normal requests) or just the content (on AJAX requests)

0

精彩评论

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