Skip to content

Instantly share code, notes, and snippets.

@mguillermin
Last active May 24, 2016 21:57
Show Gist options
  • Save mguillermin/5619197 to your computer and use it in GitHub Desktop.
Save mguillermin/5619197 to your computer and use it in GitHub Desktop.
Submitting Ajax POST with PlayFramework 2.x and the Javascript Router
...
_nS('controllers.admin.Products'); _root.controllers.admin.Products.search =
function() {
return _wA({method:"POST", url:"/" + "admin/product/search"})
}
...
...
@helper.javascriptRouter("jsRoutes")(
controllers.admin.routes.javascript.Products.search
)
jsRoutes.controllers.admin.Products.search().ajax({
data: $("#product-search-form").serialize(),
success: function(data) {
$("#results").html(data);
}
});
POST /admin/product/search controllers.admin.Products.search()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment