i have a button(click here), while clicking on it fancybox modal window is opening in that modal window there is a searchbox, to get the search results making an ajax call(request()), before send the ajax call kept a loader. Issue is while ajax loading(loader) itself close the fancybox again clicked on button the same window with loader is showing how can i refresh that.
<div id="btn">Click here</btn>
<dov class="loader" style="display:none"><img src="path"/></div>
$('#btn').click(function() {
$.fancybox({
type: 'inline',
content: '#content'
});
});
function results(){
$.ajax{
type: 'POST',
url: url,
data: data,
success:function(){
//for loog to get json data
},
beforeSend:function(){
$('.loader').css('display','block');
},
complete: function(){ $('.loader').css('display','none');}
}