Home Ajax Loader on button click - error with code
Reply: 0

Ajax Loader on button click - error with code

user1520
1#
user1520 Published in July 16, 2018, 6:16 am

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.

Any help greatly appreciated.

    <p>
        <input type="hidden" name="job_manager_form" value="<?php echo $form; ?>" />
        <input type="hidden" name="job_id" value="<?php echo esc_attr( $job_id ); ?>" />
        <input type="hidden" name="step" value="<?php echo esc_attr( $step ); ?>" />

                    <?php if($job_id){ ?>
                    <img src="https://www.salusa.co.uk/wp-content/uploads/2017/12/ajax-loader.gif" id="img" style="display:none"/ >
                    <input type="submit" id="submitjob" name="submit_job" class="button" value="Update my service profile" />


                    <?php } else { ?>
                     <img src="https://www.salusa.co.uk/wp-content/uploads/2017/12/ajax-loader.gif" id="img" style="display:none"/ >
                    <input type="submit" id="submitjob" name="submit_job" class="button" value="Submit profile for admin approval" />
                    <?php } ?>

    </p>

<script>
                    $('#submitjob').click(function(){
                    $('#img').show();
                    $.ajax({
                    ....
                    success:function(result){
                    $('#img').hide();  //<--- hide again
}
}
</script>
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.31515 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO