<script type="text/javascript">// <![CDATA[
$(document).ready(function() {
var currentSemester;
var currentCourseType;
var href;
/*Attach a submit handler to the form*/
$("#coursesForm").submit(function(e) {
e.preventDefault();
currentSemester =$("#term option:selected").val();
currentCourseType =$("#courseType option:selected").val();
if(currentSemester == "all" || currentCourseType == "all") {
href = "../academics/all-core-courses.php";
$.ajax({
url:href,
cache: false
}).done(function(data){
var allSemesterCourses = $(data).find("div.featureBody");
$("div.results").html(allSemesterCourses.html());
});
}
else {
href = "/academics/" + currentSemester + currentCourseType + ".php";
$.ajax({
url:href,
cache: false
}).done(function(data){
var allSemesterCourses = $(data).find("div.featureBody");
$("div.results").html(allSemesterCourses.html());
});
}
});
//by default loads all-core-courses page.
href = "../academics/all-core-courses.php";
$.ajax({
url:href,
cache: false
}).done(function(data){
var allSemesterCourses = $(data).find("div.featureBody");
$("div.results").html(allSemesterCourses.html());
});
});
// ]]></script>
It’s either one of htese two lines (both if/else are failing at the bottom of the respective if/else)
var allSemesterCourses = $(data).find("div.featureBody");
$("div.results").html(allSemesterCourses.html());
featureBody exists in my HTML - I see it.
So does the results div. What am I doing wrong? No HTML is being loaded into the results div.