daily pastebin goal
37%
SHARE
TWEET

Untitled

a guest Jan 18th, 2019 93 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public ActionResult SectionBook(string[] cs,string[] cname)
  2. {
  3. }
  4.  
  5. var CourseSection=new Array();
  6. var CourseName=new Array();
  7.  $('a p-button').live('click', function () {    
  8.         var schoolCourseId = $(this).attr('id');
  9.         CourseSection.push(schoolCourseId);
  10.         CourseName.push($(this).html().split("(")[0]);        
  11.     });
  12.  
  13.  
  14.  $('#btnSubmit').live('click', function () {
  15.  
  16. $.ajax({
  17.             type: 'POST',
  18.             contentType: 'application/json; charset=utf-8',
  19.             url: '/MyController/SectionBook',
  20.             //            dataType: 'json',
  21.             data: $.toJSON(CourseSection, CourseName),
  22.             success: function (result) {                
  23.                 window.location.href = '/MyController/SectionBooks'
  24.             },
  25.             error: function (xhr, ajaxOptions, thrownError) {
  26.                 alert(xhr.status);
  27.                 alert(thrownError);
  28.             },
  29.             async: false,
  30.             cache: false
  31.         });
  32.  
  33. });
  34.    
  35. var CourseSection = new Array();
  36. var CourseName = new Array();
  37. CourseSection.push("cs1");
  38. CourseSection.push("cs2");
  39. CourseSection.push("cs3");
  40.  
  41. CourseName.push("cn1");
  42. CourseName.push("cn2");
  43. CourseName.push("cn3");
  44.  
  45. var newObj = {
  46.  cn:CourseName,
  47.  cs:CourseSection        
  48. };
  49.    
  50. JSON.stringify(newObj)
  51.    
  52. $.toJSON(newObj)
  53.    
  54. var data = { courseSection:CourseSection.toString(),courseName:CourseName.toString()};
  55.             $.ajax({
  56.                 url:'/MyController/SectionBook',
  57.                 type:'GET',
  58.                 data:data,
  59.                 async:false,
  60.                 success:function(data)
  61.                 {
  62.                     window.location.href = '/MyController/SectionBooks'
  63.  
  64.                 }
  65.             });
  66.         }
  67.  
  68.  
  69. In Controller
  70. public ActionResult SectionBook(string courseSection,string courseName)
  71. {
  72.  
  73. }
  74.    
  75. $.ajax({
  76.         type: 'POST',
  77.         url: '/MyController/SectionBook',
  78.         data: {cs: CourseSection, cname: CourseName},
  79.         success: function (result) {                
  80.             window.location.href = '/MyController/SectionBooks'
  81.         },
  82.         error: function (xhr, ajaxOptions, thrownError) {
  83.             alert(xhr.status);
  84.             alert(thrownError);
  85.         },
  86.         async: false,
  87.         cache: false
  88.     });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top