I am trying to implement a simple functionality to read the filenames of the files in the posts directory.
My AJAX call is as follows(The URL is the relative URL of the posts directory)):
$.ajax({
url: "posts/",
success: function(data){
console.log(data);
$(data).find("a:contains(.html)").each(function(){
console.log("Reading...");
console.log($(this).attr("href"));
});
}
});
I get a 404 Not Found error with the following:
n.ajaxTransport.k.cors.a.crossDomain.send @ jquery.js:8630
n.extend.ajax @ jquery.js:8166
(anonymous function) @ index.js:3
n.Callbacks.j @ jquery.js:3099
n.Callbacks.k.fireWith @ jquery.js:3211
n.extend.ready @ jquery.js:3417
I @ jquery.js:3433
First of all, why am I getting cross domain error when this is in the same domain?
How should I get around resolving it?
Thanks.