Reputation: 95
please help me how i can put an async: false in this code
$.getJSON("http://192.168.1.100:8080/m-help/apps/json_doctor.php", function(data) {
$.each(data.result, function(){
$("#list").append("<li><a href='doctor-details.html?id=" +this['id']+ "'><span class='img'> <img src='http://192.168.1.100:8080/m-help/images/upload/"+this['images']+"' alt=''/></span>" +this['doclname']+ ", " +this['docFname']+ "</a></li>");
});
});
Upvotes: 0
Views: 128
Reputation: 943605
You can't. The jQuery shorthand ajax functions have very limited customisation available to them. Use .ajax
instead.
function success (data) {
$.each(data.result, function(){
$("#list").append("<li><a href='doctor-details.html?id=" +this['id']+ "'><span class='img'> <img src='http://192.168.1.100:8080/m-help/images/upload/"+this['images']+"' alt=''/></span>" +this['doclname']+ ", " +this['docFname']+ "</a></li>");
});
});
var url = "http://192.168.1.100:8080/m-help/apps/json_doctor.php";
$.ajax({
dataType: "json",
url: url,
success: success,
async: false // This is horrible and will lock up the UI while it runs
});
Upvotes: 4