Spring 4 MVC+Apache Tiles 3+JQuery -
is possible jquery function call controller method redirect description tiles page?
for instance: first, have description tiles page this:
<definition name="indexdefinitiontiles" extends="base.definition"> <put-attribute name="body" value="/web-inf/pages/_index.jsp" /> </definition> second, have method controller call description tiles page this:
@requestmapping(value = "/goingpage", produces = {mediatype.application_json_value}, method = {requestmethod.get}) public @responsebody string goingpage(httpservletrequest request) { //this definition tiles page. return "indexdefinitiontiles"; } third, have jquery function:
// catch event on button. $("#btncallgoingmethod").click(function (evt) { //here wanna call method /goingpage redirect indexdefinitiontiles }); is possible?
i take opportunity ask whether possible $.ajax, i'd wanna know how be.
at top of js file put this
var servercontext = window.location.pathname.substring(0, window.location.pathname.indexof("/",2)); then in function
// catch event on button. $("#btncallgoingmethod").click(function (evt) { window.location.href = servercontext + "/goingpage"; });
Comments
Post a Comment