You are on page 1of 6

/* * File: ajax.js * Description: This file contains the AJAX calls code made in this Project * version: 0.

1 * Created: Thu. Dec 1, 2011 * Author: Shekar Gurram * mail: shekar@wikischool.in * * Copyright (c) Wiki School Technologies 2011 * The copyright to the computer program(s) herein * is the property of Wiki School Technologies Private Limited, * India. The program(s) may not be used or copied * in accordance with the terms and conditions. */ function updateClass(classId, className) { $.ajax({ type: "GET", url: "/wikischool/admin/updateClass/", data: "classId=" + classId + "&className=" + className, success: function(updatedClass) { alert("Class Updated Successfully"); } }); } function getAmount(feeTypeId) { $.ajax({ type: "POST", url: "/wikischool/admin/getAmount/", data: "feetypeid="+ feeTypeId, success: function(amount){ // $('#oldsection').hide(); $('#student-amount').html(amount); } }); } function deleteClass(classId) { $.ajax({ type: "GET", url: "/wikischool/admin/delClass/", data: "classId=" + classId, success: function(deletedClass) { alert("Class Deleted Successfully"); } }); } function updateSubject(subjectId, subjectName) { $.ajax({ type: "GET", url: "/wikischool/admin/updateSubject/", data: "subjectId=" + subjectId +

success: } }); }

"&subjectName=" + subjectName, function(updatedSubject) { alert("Subject Updated Successfully");

function deleteSubject(subjectId) { $.ajax({ type: "GET", url: "/wikischool/admin/delSubject/", data: "subjectId=" + subjectId, success: function(deletedSubject) { alert("Subject Deleted Successfully"); } }); } function updateSection(sectionId, sectionName, classId) { $.ajax({ type: "GET", url: "/wikischool/admin/updateSection/", data: "sectionId=" + sectionId + "&sectionName=" + sectionName + "&classId=" + classId, success: function(updatedSection) { alert("Section Updated Successfully"); } }); } function deleteSection(sectionId) { $.ajax({ type: "GET", url: "/wikischool/admin/delSection/", data: "sectionId=" + sectionId, success: function(deletedSection) { alert("Section Deleted Successfully"); } }); } function updatePeriod(periodId, periodName, startTime, endTime) { $.ajax({ type: "POST", url: "/wikischool/admin/updatePeriod/", data: "periodId=" + periodId + "&periodName=" + periodName + "&startTime=" + startTime + "&endTime=" + endTime, success: function(updatedPeriod) { alert("Period Updated Successfully"); } }); }

function deletePeriod(periodId) { $.ajax({ type: "POST", url: "/wikischool/admin/delPeriod/", data: "periodId=" + periodId, success: function(deletedPeriod) { alert("Period Deleted Successfully"); } }); } // Test Module Ajax Calls -- Starting... function updateTest(testId, testName, description, testTypeId, testDate, subjectId, classId, sectionId, startTime, endTime, testStatusId, questionPaper) { $.ajax({ type: "POST", url: "/wikischool/test/update/", data: "testId=" + testId + "&testName=" + testName + "&description=" + description + "&testTypeId=" + testTypeId + "&testDate=" + testDate + "&subjectId=" + subjectId + "&classId=" + classId + "&sectionId=" + sectionId + "&startTime=" + startTime + "&endTime=" + endTime + "&statusId=" + testStatusId + "&questionPaper=" + questionPaper, success: function(updateTest) { alert("Test Update Successfully"); } }); } function deleteTest(testId) { $.ajax({ type: "POST", url: "/wikischool/test/delete/", data: "testId=" + testId, success: function(deletedTest) { alert("Test Deleted Successfully"); } }); } //Test Module Ajax Calls -- Ending... function updateExam(examId, description, examDate, subjectId, startTime, endTime, examStatusId, paperCode) {

$.ajax({ type: url: data:

"POST", "/wikischool/exams/update/", "examId=" + examId + "&description=" + description + "&examDate=" + examDate + "&subjectId=" + subjectId + "&startTime=" + startTime + "&endTime=" + endTime + "&statusId=" + examStatusId + "&paperCode=" + paperCode, success: function(updateExam) { alert("Exam Update Successfully"); }

}); } function updateExamSchedule(examScheduleId, examName, examTypeId, classId, sectionId, description) { $.ajax({ type: "POST", url: "/wikischool/exams/updateSchedule/", data: "examScheduleId=" + examScheduleId + "&examName=" + examName + "&examTypeId=" + examTypeId + "&classId=" + classId + "&sectionId=" + sectionId + "&description=" + description, success: function(updateExamSchedule) { alert("Exam Schedule Update Successfully"); } }); } function deleteExamSchedule(examScheduleId) { $.ajax({ type: "POST", url: "/wikischool/exams/delSchedule/", data: "examScheduleId=" + examScheduleId, success: function(deletedExamSchedule) { alert("Exam Schedule Deleted Successfully"); } }); } // To load sections given a class Id on AJAX function getClassSections(classId) { $.ajax({ type: "POST", url: "/wikischool/admin/getSections/", data: "classId="+ classId, success: function(sections){ // $('#oldsection').hide();

$('#section-fill').html(sections); } }); } //To load Students given a classId and sectionId on AJAX function getSectionStudents(classId, sectionId) { $.ajax({ type: "POST", url: "/wikischool/admin/students/", data: "classId=" + classId + "&sectionId=" + sectionId, success: function(students) { $('#student-fill').html(students); } }); } // Event handler for section change to load students on Ajax var sectionChangeHandler = function(){ //alert('in change event'); var classId = $('#class-id-backup').val(); var sectionId = $(this).val(); getSectionStudents(classId , sectionId); }; /* -------------------- Calls for Time Table Module ---------------*/ function saveTimeTable(saveData, classId, sectionId) { $.ajax({ type: "POST", url: "/wikischool/timeTable/save/", data: "saveData=" + saveData + "&classId=" + classId + "&sectionId=" + sectionId, success: function(saved) { alert(" Time Table Data Saved... "); } }); } /* -------------------- Calls for Time Table Module ---------------*/ /* -------------------- Calls for Student Marks Module ---------------*/ function saveStudentMarks(saveData, studentId) { $.ajax({ type: "POST", url: "/wikischool/student/saveMarks/", data: "saveData=" + saveData + "&studentId=" + studentId, success: function(saved) { alert(" Student Marks Saved... "); } }); }

/* -------------------- Calls for Student Marks Module ---------------*/

You might also like