开发者

How can I load a page by clicking on a menu bar without reloading the page

开发者 https://www.devze.com 2023-02-11 03:03 出处:网络
I have a menu, and I would like to load a page without refreshing it in the browser. T开发者_C百科he pages to be loaded are in jsp.You should use ajax for this.

I have a menu, and I would like to load a page without refreshing it in the browser.

T开发者_C百科he pages to be loaded are in jsp.


You should use ajax for this.

for example using jQuery:

onClick="$('#id').load('/path/jspfile.jsp');"

id is the id of the place you want to plant the page into.


You need to load content from other page. see example below you index.html and contact.html

<li><a onClick="$('.content').load('test.html');" href="#contact">Contact</a></li>
0

精彩评论

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