I am trying to read a json file to a javascript variable. I have read the same file previously. So the json file is in correct format.
var net_json = {};
$.ajax({
type: "GET",
url: "/karate.json",
dataType: "json",
error: function() {
alert("Error loading the file");
},
success: function(data) {
net_json = data;
alert("Success");
}
});
But it always returns alert Error loading the file. Both json and js files are in the same location.
karate.jsonw.r.t. the document/page where the above JS code is executed?error:function(jqXHR, textStatus, errorThrown){ alert(jqXHR.responseText);}catch the error with this and see what you get asresponseText!