java - Navigating to a new page of application in PLAY framework -
i working play framework 1.2.5. trying load (say) page2 on click of button (say) page1. on page1 have button , calling jquery on button follows:
$(document).ready(function(){ $("#next").click(function(){ alert("reached jquery") $.get("/nextpage"); }); });
according me above code should call url "/nextpage" route file , should go mapped method. code method is:
public static void nextpage(){ logger.info("reached nextpage method"); render(); }
now, problem method being hit, log in method getting printed. expecting method change browser url , render "nextpage.html" page on browser nothing happens. page1 stays is. no errors play side. logs printed on console , all.
is wrong render() because code working until above render().
you should not load page content after backend operation via ajax, instead, use old js redirect:
$(document).ready(function(){ $(document).on("click", "#next", function(){ alert("reached jquery") window.location.href = "/nextpage"; }); });
Comments
Post a Comment