web.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. function web_search(go)
  2. {
  3. if($('#search').val() == '')
  4. {
  5. $('#search_error').css('display', 'none');
  6. return;
  7. }
  8. loading(1);
  9. if(go) go = '/go'; else go = '';
  10. $.ajax({
  11. type: 'POST',
  12. url: home+'web/subsection/search'+go,
  13. data: 'text='+$('#search').val(),
  14. dataType: 'json',
  15. success: function(data)
  16. {
  17. $.each(data, function(i, val)
  18. {
  19. if(i == 'e')
  20. {
  21. if(val != '')
  22. {
  23. $('#search_error').css('display', 'inline-block');
  24. $('#search_error').html(val);
  25. }else
  26. $('#search_error').css('display', 'none');
  27. }
  28. if(i == 's')
  29. {
  30. $('#search_error').css('display', 'none');
  31. $('#search_result').html(val);
  32. }
  33. });
  34. loading(0);
  35. }
  36. });
  37. }
  38. function web_delete(server, type)
  39. {
  40. bootbox.dialog('<h3 class="green">Внимание</h3> Вы уверены, что хотите удалить услугу?',
  41. [{
  42. "label" : "Удалить",
  43. callback : function(){web_delete_go(server, type)}
  44. },{
  45. "label" : "Отмена",
  46. }]
  47. );
  48. return false;
  49. }
  50. function web_delete_go(server, type)
  51. {
  52. loading(1);
  53. $.getJSON('/servers/id/'+server+'/section/web/subsection/'+type+'/action/delete/go', function(arr)
  54. {
  55. $.each(arr, function(i, val)
  56. {
  57. if(i == 'e')
  58. bootbox.dialog('<h3 class="red">Ошибка</h3>'+val,
  59. [{
  60. "label" : "Продолжить",
  61. }]
  62. );
  63. if(i == 'i')
  64. bootbox.dialog('<h3 class="blue">Внимание</h3>'+val,
  65. [{
  66. "label" : "Продолжить",
  67. }]
  68. );
  69. if(i == 's')
  70. location.reload();
  71. });
  72. loading(0)
  73. });
  74. }