(function($) {
function getPageContent (section) {
$.ajax({
url: 'index.php',
method: 'POST',
datatype: 'JSON',
data: {
section: section,
},
success: function (data) {
if ( data.status == 200 ) {
$('#page-title').html(data.pageTitle);
$('#user-content').html(data.html);
}
else {
console.log("[" + data.status + "] " + data.errorCode + ": " + data.errorText);
error: function (jqXHR, exception) {
console.log(jqXHR.status + ": " + jqXHR.responseText + " | - | " + exception);
});
$(function() {
$('#navbar-home').click(function () { getPageContent (1) } );
$('#navbar-description').click(function () { getPageContent (2) });
$('#navbar-work').click(function () { getPageContent (3) });
$('#navbar-ideas').click(function () { getPageContent (4) });
$('#navbar-contact-form').click(function () { getPageContent (5) });
$('#navbar-contact-email').click(function () { window.location.href = "mailto:bryanpedini@bryanpedini.it"; });
$('ul.nav li.dropdown').hover(function () {
$(this).find('.dropdown-menu').stop(true, true).fadeIn(500);
}, function () {
$(this).find('.dropdown-menu').stop(true, true).fadeOut(500);
getPageContent(0);
})(jQuery);