I am trying to use ajax to grab an element with a specific class from another file using jQuery, parse the html to get some data out of it and put it into an object, then display the data in different markup than the original html within #content, an element on the main page..
When using load(), I can target a specific class:
$("#content").load("article.html .cover", function(){
console.log("load() success");
});
This works, but I don't want the html from article.html to be put into #content, so I tried using ajax() so that I can manipulate the html before displaying it in the callback:
$.ajax({
url: "article.html .cover"
}).done(function(){
console.log("ajax() success");
});
but this results in a 404 error. get() results are the same as ajax().
$.get("article.html .cover", function(){
console.log("get() success");
});
How can I use get() to target this specific element?