I have tried this code locally and I can't seem to get it to display the contents of the html file in my country_slide div. I've tried playing around with it a bit all to no avail. I can't seem to see any code to actually tell the ajax where to put the content.
http://jsfiddle.net/spadez/uhEgG/23/
window.onload = function () {
var a = document.getElementById("country_link");
a.onclick = function () {
$.ajax({
type: 'GET',
dataType: 'html',
url: '/ajax/test.html',
timeout: 5000,
success: function (data, textStatus) {
$("#country_slide").show();
alert('request successful');
},
error: function (xhr, textStatus, errorThrown) {
alert('request failed');
}
});
return false;
}
}
div#country_slidehas no content, and thereforeshowwill display nothing. Not to mention that it is visible by default. You must be looking for something along the lines ofTGH's answer.