Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2019
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.36 KB | None | 0 0
  1. $('#availVLANS').click(function() {
  2. $(this).attr("disabled","disabled");
  3. $.ajax({
  4. url:"<?php echo site_url('controller/methodABC/');?>",
  5. type:'POST',
  6. dataType:'json',
  7. success: function(returnDataFromController) {
  8. var htmlstring;
  9. var submitFormHTML;
  10. htmlstring = "<br><br><B>To reassign the port to a new vlan, click on a VlanId below and then click on the OK button</B><br><table class='table table-bordered table-striped'>";
  11. htmlstring = htmlstring + "<th>VlanId</th><th>Name</th>";
  12. for(i = 0; i < returnDataFromController.length; i++) {
  13. //alert(returnDataFromController[i].VlanId);
  14. htmlstring = htmlstring + "<tr><td><a href=>"+returnDataFromController[i].VlanId+"</a></td><td>"+ returnDataFromController[i].Name+"</td></tr>";
  15.  
  16. }
  17. submitFormHTML = "<form method='post' accept-charset='utf-8' action='" + BASEPATH + "index.php/switches/changeportvlan/"+ $('#ip').val() +"/" + $('#hardwaremodel').val() +"/" + $('#port').val() + "'><input type='text' name='newVlanID' id='newVlanID' style='width:5em;height:1.5em'/>&nbsp;&nbsp;<button type='submit' class='btn' name='saveVlan' id='saveVlan' style='width:10em;height:2em'>Reassign Vlan</button></form>";
  18. //alert(submitFormHTML);
  19. $('#clientajaxcontainer').html(htmlstring);
  20. $('#newvlanform').html(submitFormHTML);
  21.  
  22. }
  23. });
  24. $(this).removeAttr("disabled");
  25. });
  26.  
  27. ╔════════════════════╗
  28. ║ #progress-overlay ║
  29. ║ ╔════════════════╗ ║
  30. ║ ║ #progress-indicator
  31. ║ ╚════════════════╝ ║
  32. ╚════════════════════╝
  33.  
  34. <html>
  35. <head>
  36. ....
  37. </head>
  38. <body>
  39. <div id="progress-overlay">
  40. <div id="progress-indicator">
  41. <img src="images/myprogress.gif" /> Please Wait...
  42. </div>
  43. </div><!--progress-overlay-->
  44. <div id="website-wrapper">
  45. .... web site, layout, content, etc...
  46. </div>
  47. </body>
  48. </html>
  49.  
  50. #progress-overlay{
  51. position: absolute;
  52. width: 100%;
  53. height: 100%;
  54. background: #000;
  55. opacity: 0.2;
  56. }
  57.  
  58. #progress-indicator{
  59. position: relative;
  60. margin: 0 auto;
  61. top: 40%;
  62. width: 200px;
  63. height: 50px;
  64. }
  65.  
  66. $(document).ready(function(){
  67. $('#progress-overlay').hide();
  68. });
  69. function showProgressIndicator()
  70. {
  71. $('#progress-overlay').show();
  72. }
  73.  
  74. jQuery.ajaxSetup({
  75. beforeSend: function() {
  76. $('#loader').show();
  77. },
  78. complete: function(){
  79. $('#loader').hide();
  80. }
  81. });
  82.  
  83. $(document).ready(function(){
  84. $("#the_button").click(function(){
  85. var url = "the_controller/the_method"
  86. var data = {the: "data"}
  87. //before the POST takes place, fade-in the message
  88. $("#the_message").fadeIn();
  89. $.post(url, data, function(r){
  90. if(r.success){
  91. //when the post is finished, and it was successful, fade-out the message.
  92. $("#the_message").fadeOut();
  93. }
  94. else console.log("something bad happened");
  95. }, 'json');
  96. });
  97. });
  98.  
  99. <!-- HIDE IT BY DEFAULT -->
  100. <div id='the_message' style='display:none;'>
  101. Please wait.
  102. </div>
  103.  
  104. class The_controller extends CI_Controller{
  105. function the_method(){
  106. $p = $this->input->post();
  107. the_task($p);
  108. if(the_task_success) return json_encode(array("success" => true));
  109. else return json_encode(array("success" => false));
  110. }
  111. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement