I was practicing symfony2. And i got a problem:
I just made a simple twig page which posts data to an action of the controller, and there is a function(it works):
$.ajax({
type: 'POST',
url: "{{ path('my_test_account_register') }}",
data: account,
success: function(msg){
alert("Succeed!");
},
error: function(XmlHttpRequest,textStatus, errorThrown){
alert ("Failed! ");
}
}
I don't want to add a annotation to every action of mine, howver. I wanted to replace url: "{{ path('my_test_account_register') }}"
into url: "{{ path('MyTestBudnle:Account:register') }}"
, but i failed.
My question is: how to specify the url of an action inside a controller? Maybe this is a silly question, and this is my first time to stackoverflow. So, nice to meet you guys!