Note that there are some explanatory texts on larger screens.

plurals
  1. POJquery bootstrap scripting path update via javascript not working
    primarykey
    data
    text
    <p>I have a link in symfony2.0 generated with twig's path function like:</p> <pre><code>&lt;a id="aBtn" href="{{ path("SomeController_someControllerAction",{'section_id': section_id, 'period_id': period.getId }) }}&gt;A link&lt;/a&gt; </code></pre> <p>And i also have some javascript that updates the "section_id" part of the generated URL every time a user changes a section on the page:</p> <pre><code>function updateSectionId(id){ var aBtn = $("#aBtn"); var href = aBtn.attr('href'); var splitted = href.split("/"); splitted[splitted.length-2] = id; //My routing puts the period_id at that position //(Yes i know its pretty hardcoded...) aBtn.attr('href',splitted.join("/")); } </code></pre> <p>I have verified and the link is updated with the corresponding section_id.</p> <p>However, debugging the action that recieves this request i find out that it <em>always</em> recieves section_id = 1.</p> <pre><code>public function newQuestionDialogAction($period_id, $section_id){ //$period_id = 1 ALWAYS, regardless of href value on the link. </code></pre> <p>I am really clueless... am i missing something on twig's route generation?</p> <p>EDIT: Here is route configuration</p> <pre><code>SomeController_someControllerAction: pattern: /{period_id}/section/{section_id}/someControllerAction defaults: { _controller: "SomeBundle:SomeController:someControllerAction" } requirements: _method: GET </code></pre> <p>EDIT2: I have a hunch that the origin of this problem is the jquery-bootstrap plugin "Modal 2" used to execute ajax requests to the server. I'll let you know if i find the problem. thanks!</p> <p><a href="https://github.com/Nikku/jquery-bootstrap-scripting" rel="nofollow">https://github.com/Nikku/jquery-bootstrap-scripting</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload