post parameter not being passed zend framework 2 : <p>I've run into a bit of a problem with passing post parameters to a controller action via a ajax call. I'm not sure why it is doing it, because the other ajax calls perform as intended. The response I'm getting is as follows:  </p>

<pre><code>Notice: Undefined index: user_bio in C:\xampp\htdocs\module\Members\src\Members\Controller\ProfileController.php on line 149
</code></pre>

<p>The controller code is:</p>

<pre><code>public function changebioAction()
{
    $layout = $this-&gt;layout();
    $layout-&gt;setTerminal(true);

    $view_model = new ViewModel();
    $view_model-&gt;setTerminal(true);

    if ($this-&gt;request-&gt;isPost()) {
        try {
            $params = $this-&gt;params()-&gt;fromPost();

            $this-&gt;getProfileService()-&gt;editProfile(array('bio' =&gt; ltrim($params['user_bio'])));
        } catch (ProfileException $e) {
            $this-&gt;flashMessenger()-&gt;addErrorMessage($e-&gt;getMessage());

            return $this-&gt;redirect()-&gt;toRoute('members/profile', array('action' =&gt; 'change-failure'));
        }
    }

    return $view_model;
}
</code></pre>

<p>The javascript and html:</p>

<pre><code>// handle quick edit of bio
function quickEditBio(element, button) {
    var edited_data = $(element).html();

    var data = $(element).blur(function() {
        edited_data = $(element).map(function() {
            return this.innnerHTML;
        }).get();
    });

    $(button).on('click', function() {
        $.ajax({
            method : "POST",
            url : "/members/profile/change-bio",
            data : {
                user_bio : edited_data[0]
            }
        }).done(function(msg) {
            // bio saved
            // go back to profile page
            //location.href = '/members/profile';
            alert(msg);
        }).fail(function() {
            alert("Error changing bio, please try again.");
        });
    });
}

&lt;button onclick="expand('bio')" class="w3-btn-block w3-theme-d2 w3-left-align"&gt;
                &lt;i class="fa fa-book fa-fw w3-margin-right"&gt;&lt;/i&gt; Bio
            &lt;/button&gt;

            &lt;div id="bio" class="w3-accordion-content w3-container"&gt;
                &lt;div class="w3-display-container"&gt;
                    &lt;p id="bio-user" contenteditable="true"&gt;
                        &lt;?php echo $this-&gt;layout()-&gt;bio; ?&gt;
                    &lt;/p&gt;

                    &lt;div class="w3-display-right"&gt;
                        &lt;button class="w3-btn-block w3-theme-d2" id="save-bio"&gt;Save&lt;/button&gt;
                    &lt;/div&gt;

                    &lt;script type="text/javascript"&gt;
                        quickEditBio('#bio-user[contenteditable=true]', $('#save-bio'));
                    &lt;/script&gt;
                &lt;/div&gt;
            &lt;/div&gt;
</code></pre>

<p>As stated before, the error I'm getting is that the index user_bio is undefined :</p>

<pre><code>Notice: Undefined index: user_bio in C:\xampp\htdocs\module\Members\src\Members\Controller\ProfileController.php on line 149
</code></pre>

<p>The part that is really confusing is that other parts use this same code and work just fine. </p>

<p>Any help would be appreciated.</p>

<p>Thanks!</p>
