0

Possible Duplicate:
Play! Framework: Best practice to use URLs in separate JavaScript files?

we are able to insert successfully values in database with this code:

$.ajax({type: "POST", url: "@{Receipes.add('nameIng','quantity')}",

but not with the parameters like:

$.ajax({type:

"POST", url: "@{Receipes.add(':nameIng',':quantity')}",
                    data: {nameIng: "Potato", quantity: "2" } });

any clues?

4

1 回答 1

1

您正在寻找的是jsAction模板标签。在你的情况下,它可以这样使用:

var addReceipeAction = #{jsAction @Receipes.add(':nameIng', ':quantity') /};
$.ajax({type: "POST", url: addReceipeAction({nameIng: "Potato", quantity: 2})});
于 2012-12-09T16:25:41.373 回答