Skip to main content
/* Ask AU */ const $pageH1 = $("#content-title"), $askAUWrapper = $("#askau-wrapper"), $askAUQuestion = $("#askau-question"), $askAUAaswer = $(".askau-answer"), $exploreAskAUQuestions = $(".ask-au-explore-questions-by-topic"), $contactFormWrap = $(".form-wrap"), $pageLastUpdate = $(".last-update"); $.ajax({ url: 'https://www.athabascau.ca/scripts/university-relations/mainsite/askau/index.php', type: 'POST', data: {data: window.location.search}, success: function (response) { /* load results via ajax call from askau/index.php */ $askAUWrapper.html(response); $pageH1.css("visibility", "visible"); if ( $askAUAaswer.length ) { $contactFormWrap.show(); } $(".last-update").css("visibility", "visible"); $.getScript('https://www.athabascau.ca/framework/v1/theme/js/mainsite/askau.js', function() { $exploreAskAUQuestions.fadeIn("slow"); $(".loader").slideUp(); }); }, error: function (e) { console.log(e); }, }); $(document).ajaxStop(function () { if ($('.askau-question').length) { let $question = $('.askau-question').text(); $question = $question.replace(" Print page",""); document.title = $question + " | Ask AU | Athabasca University"; $contactFormWrap.show(); } }); function checkRecaptcha() { var $reCaptcha = grecaptcha.getResponse(); if ($reCaptcha.length > 0) { document.getElementById("g-recaptcha-error").innerHTML = ""; return true; } else { document.getElementById("g-recaptcha-error").innerHTML = '

Please verify that you are not a robot.

'; return false; } } var contactForm = $("#askau-contact-form"); contactForm.validate({ errorElement: "span", errorPlacement: function (error, element) { error.insertBefore(element.parent(".input-group, .checkbox, .radio-group")); }, errorLabelContainer: "#form-error", rules: { confirm_email: { equalTo: "#email", }, }, messages: { confirm_email: { equalTo: "Email address must match", }, }, submitHandler: function submitForm() { /* Get the values from the form */ var fname = $("#firstname").val(); var lname = $("#lastname").val(); var q = $("#askau-input").val(); var type = $("#type").val(); var title = $("#title").val(); var email = $("#email").val(); var phone = $("#phone").val(); var category = $("input[name='categories']:checked").val(); var student_id = $("#student_id").val(); var question = $("#question").val(); /* checking if recaptcha has been interacted with */ if (checkRecaptcha()) { $.ajax({ type: "POST", url: "https://www.athabascau.ca/scripts/university-relations/mainsite/askau/form-submission.php", data: { firstname: fname, lastname: lname, q: q, type: type, title: title, email: email, phone: phone, categories: category, question: question, student_id: student_id, captcha: grecaptcha.getResponse(), }, success: function (response) { contactForm.fadeOut("slow", function () { var $email = $("#email").val(); $("#thank-you").fadeIn("slow"); $("#thank-you p strong").text($email); }); }, }); return false; } }, }); /* Smooth scroll to top 10 questions by topic */ $(function () { setTimeout(function () { var hash = window.location.hash; if (hash == "#questions-by-topic") { $("html, body").animate( { scrollTop: $("#questions-by-topic").offset().top - 10, }, 500 ); return false; } }, 700); });