I am doing assignment in ASP.net MVC5. When i do ajax call it successffully go to action method(debugged). But after that when i make markup of something it and append to the body it give the error in jquery min.js and the error on console is : Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. jquery-1.11.0.min.js:4 Uncaught ReferenceError: $document is not defined
My code is below:
$.ajax({
url: url,
type: "GET",
contentType: "application/json; charset=utf-8",
cache: false,
async: false,
success: function (data, status) {
if (status && data) {
var Markup = data;
var Title = Id && Id != null ? "edit" : "New";
$AddEdit = BootstrapModal.createAndShow("modal", Title, Markup); // this is another method in JS
}
},
error: function () {
alert("not workig");
}
});
Bootstrap method is:
var createAndShow = function (ElementId, Title, Markup) {
debugger;
//Here some markup is creating and append to body
$("body").append(Markup); //Here error come
Why ajax call give error of Synchronous XMLHttpRequest on the main thread is deprecated?- because synchronous XMLHttpRequest is deprecated in every modern browser$document is not defined- as the code you posted doesn't refer to $document anywhere, then I'd say that error is in code you have not postedasync: falseshould never be used. remove it and your error will be gone.