weixin_33725126 2015-01-23 23:27 采纳率: 0%
浏览 7

用ajax重定向

I have a method in some controller that is being used to display something inside a twig template. The content of this template depends on the value of a parameter passed to this method.

The code is:

class FooController {
  public function fooBarAction($parameter)
  {
    // do something
    if($_POST)
    {
      // do something
      return $this->redirect('foo_bar');
    }
    return $this->render('AcmeBundle:view.html.twig', [
      'content' => $parameter
    ]);
  }
}

So having some menu in this twig template, I create a couple of links to the foo_bar route with different parameters, like:

<a href="{{ url('foo_bar', {'parameter', 'aaa'}) }}">aaa</a><br>
<a href="{{ url('foo_bar', {'parameter', 'bbb'}) }}">bbb</a>

What if I'd like to do this with ajax, so that the page loads faster? How could I do this?

So far I've created click event in jQuery, that catches the menu clicks, and gets parameter's value, but what now? How do I do this? I have no idea where to begin.

Thanks!

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 如何在scanpy上做差异基因和通路富集?
    • ¥20 关于#硬件工程#的问题,请各位专家解答!
    • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
    • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
    • ¥30 截图中的mathematics程序转换成matlab
    • ¥15 动力学代码报错,维度不匹配
    • ¥15 Power query添加列问题
    • ¥50 Kubernetes&Fission&Eleasticsearch
    • ¥15 報錯:Person is not mapped,如何解決?
    • ¥15 c++头文件不能识别CDialog