Advertisement
Guest User

Untitled

a guest
Dec 20th, 2014
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var max = 5; var min = 3; $('.question-rankings td:nth-child(3)').each(function() {$(this).find('input:radio').eq(Math.floor(Math.random()*(max-min+1)+min)-1).attr('checked', true);});$('.question-answers').each(function() {$(this).find('li').eq(Math.floor(Math.random()*(max-min+1)+min)).find('input:radio').attr('checked', true);});$('.question-answers').each(function() {$(this).find('li').eq(Math.floor(Math.random()*(max-min+1)+min)-2).find('input:radio').attr('checked', true);}); ketQuaDG.info.completed = 1; ketQuaDG.info.currentSectionIdx = 0; ketQuaDG.details = new Array(); $('#formSurvey input[type="radio"]:checked').each(function (idx, radio) {var ids = $(this).attr('id').split('_'); ketQuaDG.details.push({ questionId: ids[0], answerId: ids[1], comment: '', type: 'radio' }); }); $('#formSurvey input[type="checkbox"]:checked').each(function (idx, check) { var ids = $(this).attr('id').split('_'); ketQuaDG.details.push({ questionId: ids[0], answerId: ids[1], comment: '', type: 'checkbox' }) }); $('#formSurvey textarea').each(function (idx, text) { if ($(this).val() != '') { ketQuaDG.details.push({ questionId: $(this).attr('id'), answerId: 0, comment: $(this).val(), type: 'comment' }); } }); var times = 0; var xhr =  function() {$.ajax({ type: "POST", url: 'Modules/DGDanhGia/HandlerDGDanhGia.ashx?method=LuuDanhGia', data: JSON.stringify(ketQuaDG), contentType: "application/json; charset=utf-8", dataType: "json", cache: false, async: true, success: function (result) {  if (result.code == 1) { $('.survey-thanks').show(); ob_ShowMessage("Ban dã dánh giá thành công.", 1); $('#btnSave, #btnPrevSection, #btnNextSection').hide(); alert("Hoan tat!");} else { times++; $('.survey-thanks').show(); ob_ShowMessage("Thu lai lan thu:" + times, 1);  xhr();} }, error: function () { ob_ShowMessage('Có loi xay ra. Vui lòng thu lai.', 3); window.scrollTo(0, 0); $('#btnNextSection, #btnSave').removeAttr('disabled'); } }); }; xhr();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement