1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
$(document).ready(function(){
$('#sch_dropdown').hide();
function populate() 
 {
       fetch.doPost('core/code/includes/search.php');
	}


$('#region').change(populate);

var fetch = function() {
		
var schools = $('#school');
return {
	doPost: function(src) {

    $('#loading').show();
    $('#sch_dropdown').hide(); 
    $('#no_sch').hide(); 


		  if (src) $.post(src, { region_code: $('#region').val() }, this.getschools);
		else throw new Error('No SRC was passed to getCounties!');
	},
			
	getschools: function(results) {
		if (!results)     {
       $("#cl_dropdown, #sch_dropdown").hide();
	   $('#no_sch').show(); 
    };
		schools.html(results);

	$('#loading').hide(); // Hide the Loading...
	$('#sch_dropdown, #cl_dropdown,').show(); // Show the drop down
	}	
}
}();

populate();

});