Im showing a loading gif beforeSend and hide it after complete insid an ajax function. Is there any way other then timeout to show the gif only if the call takes longer than 0.5 seconds for example?
...
beforeSend:function(){
$(".preloader").show();
},
success: function(data) {
$("#tsprices").html(data);
// console.log(data)
},
complete: function() {
$(".preloader").hide();
},
...