I am trying to do a pretty basic AJAX request at the moment, just to test functionality, routing my calls through admin-ajax.php. However, every time I try to fire the AJAX request, I get a 404 error that says "Uncaught syntaxerror: Unexpected token <". Wtf? It appears to be doing this because of the carot in my DTD... I've been through my code but can't figure out what I'm doing wrong here...I'm fairly new to working with AJAX so any help would be appreciated.
The php in functions.php is nothing...
function shows_callback(){
echo '<h1>Test</h1>';
}
The ajax call...
$(".tabs .btn").click(function(e) {
e.preventDefault();
$.ajax({
url:"/wp-admin/admin-ajax.php",
type: "GET",
dataType: "html",
cache: false,
data: {
action: "shows"
},
success: function(resp) {
$(".ajax-show").append(resp);
},
error: function(xhr, status, error){
var err = JSON.parse(xhr.responseText);
console.log(err);
}
});
});
What could I be doing wrong here?
EDIT: The full error:
Uncaught SyntaxError: Unexpected token <
Which I figure is related to the dataType, but I've declared html, so I don't understand...