title: Ajax call to my Zend controller
body: <p>I am bit new to zend framework. Trying to do an Ajax call to my controller/indexAction() and I am receiving error alert. 
  Can someone please help? I tried to get answer from other posts, but could not able to get the correct solution. </p>
  
  <p>My JS file with Ajax action. </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>    $('.libox').click(function () {
          var contentPanelId = $(this).attr("id");
          alert(contentPanelId);
          $.ajax({
              url: "public_html/application/controllers/IndexController.php",
              type: "POST",
              dataType: 'json',
              data: contentPanelId,
              success: function (data) {
                  alert(data);
              },
              error: function () {
                  alert("fail :(");
              }
          });
      });</code></pre>
  </div>
  </div>
  </p>
  
  <p>My Controller </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>class IndexController extends Zend_Controller_Action {
  
  public function indexAction() {
  
  
      if ($this-&gt;getRequest()-&gt;isXmlHttpRequest()) {
          if ($this-&gt;getRequest()-&gt;isPost()) {
              $_custObj = new Application_Model_DbTable_Shuffle();
              $this-&gt;_helper-&gt;json($_custObj-&gt;getData());
          }
      } else {
      }
  }
  
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>Control is always going to error: function() shown in Ajax call and getting "fail:(" alert. </p>