title: Ajax Loader on button click - error with code
body: <p>I've followed other advice regarding showing an Ajax Loading Gif on button click to submit a form, however I can't seem to get the code working.</p>
  
  <p>Any help greatly appreciated.</p>
  
  <pre><code>    &lt;p&gt;
          &lt;input type="hidden" name="job_manager_form" value="&lt;?php echo $form; ?&gt;" /&gt;
          &lt;input type="hidden" name="job_id" value="&lt;?php echo esc_attr( $job_id ); ?&gt;" /&gt;
          &lt;input type="hidden" name="step" value="&lt;?php echo esc_attr( $step ); ?&gt;" /&gt;
  
                      &lt;?php if($job_id){ ?&gt;
                      &lt;img src="https://www.salusa.co.uk/wp-content/uploads/2017/12/ajax-loader.gif" id="img" style="display:none"/ &gt;
                      &lt;input type="submit" id="submitjob" name="submit_job" class="button" value="Update my service profile" /&gt;
  
  
                      &lt;?php } else { ?&gt;
                       &lt;img src="https://www.salusa.co.uk/wp-content/uploads/2017/12/ajax-loader.gif" id="img" style="display:none"/ &gt;
                      &lt;input type="submit" id="submitjob" name="submit_job" class="button" value="Submit profile for admin approval" /&gt;
                      &lt;?php } ?&gt;
  
      &lt;/p&gt;
  
  &lt;script&gt;
                      $('#submitjob').click(function(){
                      $('#img').show();
                      $.ajax({
                      ....
                      success:function(result){
                      $('#img').hide();  //&lt;--- hide again
  }
  }
  &lt;/script&gt;
  </code></pre>