title: Calling PHP function using ajax not working
body: <p>I am calling a php function using ajax call but its not working. I have a table with some rows when I click on any column of a row it becomes editable with its value but when I edit the value and click on another column or enter the changed value is not displayed again. Actually I am doing an ajax call where I change the data of the column in my table but its not calling that php function. </p>
  
  <p>My script is as follows</p>
  
  <pre><code>&lt;script type="text/javascript" &gt;
  $(document).ready(function()
  {
      $(".edit_tr").click(function()
      {
          var ID=$(this).attr('id');
          $("#span_"+ID).hide();
          $("#input_"+ID).show();
      }).change(function()
      {
          var ID=$(this).attr('id');
          var input=$("#input_"+ID).val();
          var dataString = 'id='+ ID +'&amp;data='+input;
          $("#span_"+ID).html('&lt;img src="load.gif" /&gt;'); // Loading image
  
          if(input.length&gt;0)
          {
  
              $.ajax({
                  type: "POST",
                  url: "worker_app::edit_ajax()",
                  data: dataString,
                  cache: false,
                  success: function(html)
                  {
                      $("#span_"+ID).html(span);
                  }
              });
          }
          else
          {
              alert('Enter something.');
          }
  
      });
  
      // Edit input box click action
      $(".editbox").mouseup(function()
      {
          return false
      });
  
      // Outside click action
      $(document).mouseup(function()
      {
          $(".editbox").hide();
          $(".text").show();
      });
  
  });
  </code></pre>
  
  <p></p>
  
  <p>The HTML table looks like this </p>
  
  <pre><code>&lt;tbody&gt;
    &lt;tr id="{IDWORKERS}" class="edit_tr"&gt;
      &lt;td class="edit_td"&gt;
        &lt;span id="span_{IDWORKERS}" class="text"&gt;{FIRM}&lt;/span&gt;
        &lt;input type="text" value="{FIRM}" class="editbox" id="input_{IDWORKERS}" /&gt;
      &lt;/td&gt; 
    &lt;/tr&gt;
  &lt;/tbody&gt;
  </code></pre>
  
  <p>And the php function is inside apps folder in a file called wroker_app.php </p>
  
  <pre><code>public function edit_ajax(){
      ///echo "&lt;pre&gt;";
      ///print_r($_POST);
      //echo "&lt;/pre&gt;";
     // sql to update the database goes here
      echo 'I am here';
  }
  </code></pre>
  
  <p>Any ideas?</p>
  
  <p>Thanks in advance</p>