javascript - how add function beforeSend in callback -
i have quetion jquery, how add function beforesend & success
code :
$("body").on("click", "#br-submit-assets", function(e) { var form = $(this).parents("form"); var btn = $(this); form.ajaxsubmit(function(ret) { $("#loadding").html('<i class="fa fa-spinner fa-pulse"></i>'); $(".career-notif").parent("div").remove(); var html = generate_alert(ret.result.status, ret.result.msg); btn.parent("div").before(html); }); return false; });
it's work me want display #loading
before send data :
beforesend: function () { $('#loading').append('<i class="fa fa-spinner fa-pulse"></i>'); },
try this
beforesend: function () { $('#loading').show(); } success : function(data){ $('#loading').hide(); }
and in html add div this
<div id="loading" style="display:none"><img src="images/loader.gif" /></div>
Comments
Post a Comment