开发者

symfony jq_link_to_remote using POST fails

I'm trying to use a simple ajax link:

jq_link_to_remote('Click me!', array(  'update' => 'myDiv',
                                       'url'    => 'module/action?id='.$user->getId(),
                                       'method' => 'post' ));

The action is really simple:

public function executeAction(sfWebRequest $request)
{
    return $this->renderText('test');
}

When I press the link nothing hap开发者_如何学编程pens. If I change the 'method' to 'get' it works as expected - How can that be?


It's been a long time since I've played with this plugin, but a quick look in the docs says POST is default and only GET would need to be declared. So my first guess would be that declaring the method as post breaks it. In other words, remove the method declaration altogether to make it a POST.

http://www.symfony-project.org/book/1_2/11-Ajax-Integration#chapter_11_sub_determining_the_ajax_request_method


I added

requirements:
    sf_method: [get, post]

to the module/action route and it works now :)

thanks for the help Tom!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜