Advertisement
Guest User

Untitled

a guest
May 31st, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 2.28 KB | None | 0 0
  1. <form id="cmd_form" method="post">
  2.     <div>
  3.      
  4.         <input type="radio" id="rec_video" name="Command" /><label for="rec_video">Включить запись видео</label><br />
  5.         <input type="radio" id="rec_sound" name="Command" /><label for="rec_sound">Включить запись звука</label><br />
  6.         <input type="radio" id="logs_upload" name="Command" /><label for="logs_upload">Загрузить логи SMS и Звонков</label><br />
  7.  
  8.         <button type="button" id="sub" value="sub">Подтвердить действие</button>
  9.  
  10.         <input type="submit" id="submit_form" value="Отправить" />
  11.     </div>
  12. </form>
  13.  
  14. <script>
  15.  
  16.     var devIpAddr;
  17.     var devCmd;
  18.  
  19.  
  20.     var sample = {};
  21.     sample.postData = function () {
  22.            
  23.     };
  24.  
  25.     $('#sub').click(function (e) {
  26.         e.preventDefault();
  27.  
  28.         var cmd = "";
  29.  
  30.         if (document.getElementById('rec_video').checked) {
  31.             cmd = "cmd_rec_video";
  32.             $.ajax({
  33.                 type: "POST",
  34.                 url: "@Url.Action("PostCommand")",
  35.                 data: "command = [{cmd :" + cmd + "}]",
  36.                 success: function (data) { alert('data: ' + data); },
  37.             complete: function () { alert('finished'); alert(); }
  38.  
  39.         });
  40.  
  41.     }
  42.         if (document.getElementById('rec_sound').checked) {
  43.             cmd = "cmd_rec_sound";
  44.             $.ajax({
  45.                 type: "POST",
  46.                 url: "@Url.Action("PostCommand")",
  47.                 data: "command = [{cmd :" + cmd + "}]",
  48.             success: function (data) { alert('data: ' + data); },
  49.             complete: function () { alert('finished'); alert(); }
  50.  
  51.         });
  52.  
  53.         }
  54.  
  55.     if (document.getElementById('logs_upload').checked) {
  56.         cmd = "cmd_logs_upload";
  57.  
  58.         $.ajax({
  59.             type: "POST",
  60.             url: "@Url.Action("PostCommand")",
  61.             data :  "command = [{cmd :"+ cmd+"}]",
  62.         success: function (data) { alert('data: ' + data); },
  63.         complete: function () { alert('finished'); alert(); }
  64.  
  65.     });
  66.  
  67.     }
  68.     if (cmd == "") alert("Не выбрана команда");
  69.  
  70.        
  71.     //devCmd = cmd;
  72.     //sample.postData(devCmd);
  73.  
  74.  
  75.     alert('sample=' + sample);
  76.     });
  77.  
  78.  
  79. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement