| Current Path : /var/www/html/venkat/phphtdocs/js/ |
| Current File : /var/www/html/venkat/phphtdocs/js/scripts.js |
$(document).ready(function() {
$("#demo").html("Hello World!");
});
function checkCreditLimit() {
var i = 0;
var totalcredits = parseInt('0');
var courses = [];
$('input[type=checkbox]:checked').map(function(_, el) {
jQuery.ajax({
type: "POST",
url: 'coursecredits.php',
dataType: 'json',
async: false,
data: {coursename: $(el).val()},
success: function (obj, textstatus) {
totalcredits += parseInt(obj);
// alert(totalcredits);
}
});
courses[i++] = $(el).val();
}).get();
if(totalcredits > 12) {
alert("Cannot select more than 12 credits! Please reduce course(s).");
} else {
i = 0;
var l = courses.length;
while (i < l){
// alert(courses[i]);
jQuery.ajax({
type: "POST",
url: 'storeselection.php',
dataType: 'json',
data: {coursename: courses[i++]},
success: function (obj, textstatus) {
alert('Added preferences.');
}
});
}
}
}