简体   繁体   中英

VelocityTemplate : How to avoid re-loading of navigation bar while using #parse()

I have good knowledge of java but 0 knowledge of Velocity. I have a task in which I have to stop collapsing of dropdown options of navigation bar. First I thought its a twitter bootstrap issue (collapsing dropdown) but then i realize that every dropdown-option on which I am clicking, is loading the entire page including the navigation bar and that's why dropdown is closing every time .

So lets say I have a page sample.html having #parse("common.vm.html") inside it and page common.vm.html having #parse("header.vm.html") inside it; header.vm.html is the page where I have my navigation bar implementation.

You must realize that Velocity evaluates on the server side, so can only happen on a page reload.

If you only want to reload a part of the page, use ajax calls from the javascript side.

For instance, using jquery:

$('.dropdown_option').click(function()
{
    $('#dynamic_content').load('/path/to/dynamic/part.vm.html');
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM