I'm trying to render an ajaxButton in Lift that, once clicked, updates a SessionVar and then goes to another page using href:
def render ={
"li *" #> userItems.map(item =>
"li.button_open" #> SHtml.ajaxButton("Open", () => ajaxButtonOpen(item),
"class" -> "btn btn-primary", "href" -> {Site.menuItem.url})
)
}
def ajaxButtonOpen(item:Item) : JsCmd = {
UsersCurrentItemId apply item._id
JsCmd.unitToJsCmd(Unit)
}
This code will execute ajaxButtonOpen but will not go to the Site.menuItem. I've tried other alternatives such as:
"li.button_test" #> <a class="btn btn-primary" href= {Site.menuItem.url} onClick="{ajaxButtonOpen(item)}"> "Open"</a>
Does anyone know where I'm going wrong? Any help would be greatly appreciated.