My loadView function is a somehow broken
function loadView(view){
$.get("../content/mainView.html", function(data) {
$("#content-container").html(data);
})
.done(function() {
console.log("done");
})
.fail(function(xhr, status, error) {
console.log("fail");
console.log(error);
});
}
I dont know what is wrong with me since I dont even can debug it since
console.log(error);
just gives me an empty response.
Can someone tell me whats wrong with my code and why
console.log(error);
dont give any response?
It is possible in AJAX/GET request world that you may get empty error parameter in fail scenarios.
error object is the message sent from server, In case request doesnt reached till server you may get empty response.
I would recommend to use textStatus
The three parameters are explained below respectively.
.fail(function(jqXHR , textStatus , error)...... jqXHR is a JS object textStatus is "error" error is "Internal Server Error", it's the error message sent by the server.