Reputation: 489
Is it possbile to check whether the content is loaded fully in the ajax call made and after that show some div. Till the content is not loaded fully the div should not shown and after the content is come then the div has to be shown using jquery?
Upvotes: 1
Views: 130
Reputation: 30185
Use jQuery ajax call success callback. It will fires only after finishing the request:
$.ajax({
type: "GET",
url: "some.html",
success: function(data){
// show my div here
$('#mydivid').html(data).show();
}
});
Upvotes: 1
Reputation: 31043
the answer is based on total assumptions, also define an error callback
$.ajax({
url: "/path/to/server",
type: 'POST',
data: data,
success: function(data){ <-- the success is called upon successful completion
//do something with data
$("#divID").html(data);
$("#divID").show(); <-- assumed the div was hidden initially
},
error:function(jxhr){
if(typeof(console)!='undefined'){
console.log(jxhr.status+"--"+jxhr.responseText);
}
}
});
Upvotes: 1