Problem with page loading content, inside content

丶灬走出姿态 提交于 2019-12-02 19:43:46

问题


if you visit here: Example You will see my problem.

The page loads, then loads all the same content within a div id=content

Have a look at the source for the JS/jQuery and if you need the PHP just let me know. Im not too sure if its the JS or PHP that's doing this. I use the jQuery Address Plugin so maybe im not using it properly but this is killing me.

any ideas on what i could be doing wrong? in Firebug the page loads and simply doesn't stop. Try it out if you have it.

Any help is appreciated!!


回答1:


This line of code:

$('.content').load('http://laynestaley.co.uk/test/'+fragment+'?ajax=1');

Is actually loading the entire page into <div class='content'></div>. Your server-side code must not be executing the way you expect it to with that AJAX call (It's just loading the index page of /test/ again).




回答2:


I agree with @Andrew, but just a suggestion -- if you don't want the page to "snap" when the AJAX is loaded, set your height in css to something like 100%




回答3:


You are incorrectly building fragment. In you code first letter truncated in query.

Correct code:

fragment = event.value.substring(2);


来源:https://stackoverflow.com/questions/6391244/problem-with-page-loading-content-inside-content

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!