title: Uncaught ReferenceError: function is not defined jQuery
body: <p>I am trying to call jQuery function when button is clicked. But I am getting the error as follows:</p>
  
  <p>Uncaught ReferenceError: update_question_ajax is not defined </p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;button type="button" class="update-question-&lt;?php echo $i; ?&gt; button" onclick="update_question_ajax(&lt;?php echo $i; ?&gt;)" style="outline: 0 none;"&gt;&lt;?php _e('Update') ?&gt;&lt;/button&gt;
  </code></pre>
  
  <p>jQuery:</p>
  
  <pre><code>$(function(){
      function update_question_ajax(id)
      {
          var test = $('.edit-question-' + id + ' input[name="translated"]');
          var editedQuestionId = $('#question-id-'+id).val();
          var editedQuestionObj = $('.edit-question-' + id + ' input[name="translated"]').val();
          var modalObj = $('#myQuestionModal');
  
          $.ajax({
              type: "POST",
              url: "&lt;?php echo base_url('admin/question/admin_edit_question'); ?&gt;",
              data:{
                  edited_question: editedQuestionObj,
                  question: editedQuestionId
              },
              success: function(){
                  modalObj.dialog('close');
                  modalObj.html('');
              },
              complete: function(){
                  //window.location.reload(true);
              }
          });
          return false;
      }
  });
  </code></pre>
  
  <p>I appreciate if you guys help me out about this.</p>
  
  <p>Thank you!</p>