I have a problem of my page redirect into Undefined. I have not much experience in coding. I am using some of the code that I have found here. I am using a simple ajax page load code.
$(document).ready(function() {
// load index page when the page loads
$("#response").html("DEFAULT");
$("#page1").click(function() {
// load home page on click
$("#response").html("https://apemedia.my/without-reload-home/");
});
$("#page2").click(function() {
// load about page on click
$("#response").html("https://apemedia.my/without-reload-contact/");
});
$("#page3").click(function() {
// load contact form onclick
$("#response").html("https://apemedia.my/without-reload-about/");
});
});
The ajax page load effect is working and I continue to implement some fade in fade out effects with it. The fade in effect is alright, and also the fadeout effect seems working, but then when the page redirect, it redirect "Undefined".
$(document).ready(function () {
$('#et-main-area').css('display', 'none');
$('#et-main-area').fadeIn(3000);
$('.link').click(function(event) {
event.preventDefault();
newLocation = $('.link a').attr("href");
$('#et-main-area').fadeOut(2500, newPage);
});
function newPage() {
window.location = newLocation;
}
});