scala - Play Framework not refreshing page when javascript posts a change -
so issue have have 2 combo boxes, comboone , combotwo. combotwo's population dependent on selection of comboone ... i.e. when comboone selected want hit server , pass in relevant values combotwo.
everything seems joinning , call returns controller gets called .. weirdly not refresh page ... true if send entirely different page.
so code ... scala template looks ...
@(adminaccess: boolean, thelocationclasstimes: list[string]) <!doctype html> : : <script> function populateclasstimeselect(classlocation) { var req = new xmlhttprequest() ; req.open("post", "/locationclasstimes/" + classlocation); req.onload = function ( e ) { if ( req.status = 200 ) { document.reload(true); } }; req.send(); } </script> : // , use "thelocationclasstimes" list down here
the routes file has ...
get /contacts.html controllers.application.contacts post /locationclasstimes/:classlocation controllers.application.locationclasstimes(classlocation: string)
... , controller ...
def contacts = secureaction { request => ok(views.html.contacts(isadminuser(request), list("andyone", "andytwo"))) } def locationclasstimes(classlocation: string) = secureaction { request => val validclasstimesforlocation = list("hello1","hello2", classlocation) ok(views.html.contacts(!isadminuser(request), validclasstimesforlocation)) }
what should naming poor here .. "locationclasstimes" function called expected , , create new list. html page not refresh new content. , if send entirely different page can see required processing ( i.e. reading db page ) doesn't render it.
so guess have 2 main questions: (1) there obvious doing wrong connect dots here (2) there easier way connect comboone combotwo in play framework .. want hit service/db tier @ point.
many pointers @ entirely new things front end webby!
Comments
Post a Comment