Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public ActionResult SectionBook(string[] cs,string[] cname)
- {
- }
- var CourseSection=new Array();
- var CourseName=new Array();
- $('a p-button').live('click', function () {
- var schoolCourseId = $(this).attr('id');
- CourseSection.push(schoolCourseId);
- CourseName.push($(this).html().split("(")[0]);
- });
- $('#btnSubmit').live('click', function () {
- $.ajax({
- type: 'POST',
- contentType: 'application/json; charset=utf-8',
- url: '/MyController/SectionBook',
- // dataType: 'json',
- data: $.toJSON(CourseSection, CourseName),
- success: function (result) {
- window.location.href = '/MyController/SectionBooks'
- },
- error: function (xhr, ajaxOptions, thrownError) {
- alert(xhr.status);
- alert(thrownError);
- },
- async: false,
- cache: false
- });
- });
- var CourseSection = new Array();
- var CourseName = new Array();
- CourseSection.push("cs1");
- CourseSection.push("cs2");
- CourseSection.push("cs3");
- CourseName.push("cn1");
- CourseName.push("cn2");
- CourseName.push("cn3");
- var newObj = {
- cn:CourseName,
- cs:CourseSection
- };
- JSON.stringify(newObj)
- $.toJSON(newObj)
- var data = { courseSection:CourseSection.toString(),courseName:CourseName.toString()};
- $.ajax({
- url:'/MyController/SectionBook',
- type:'GET',
- data:data,
- async:false,
- success:function(data)
- {
- window.location.href = '/MyController/SectionBooks'
- }
- });
- }
- In Controller
- public ActionResult SectionBook(string courseSection,string courseName)
- {
- }
- $.ajax({
- type: 'POST',
- url: '/MyController/SectionBook',
- data: {cs: CourseSection, cname: CourseName},
- success: function (result) {
- window.location.href = '/MyController/SectionBooks'
- },
- error: function (xhr, ajaxOptions, thrownError) {
- alert(xhr.status);
- alert(thrownError);
- },
- async: false,
- cache: false
- });
Add Comment
Please, Sign In to add comment