我创建了一个 symfony2 服务,我想从客户端 Ajax(jQuery) 调用它,并在 Ajax 的成功函数中返回该服务所做的查询结果:
services:
acme.services.exampleservice:
class: Acme\ExampleBundle\Services\ExampleService
arguments:
entityManager: "@doctrine.orm.entity_manager"
阿贾克斯:
$.ajax({
type: "GET",
url: "?????????????",
dataType: 'json',
success: function(result)
{ //do something with the result query }
});
这是可能的吗?,如果可以,我该怎么做?