Advertisement
Guest User

Untitled

a guest
May 19th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.48 KB | None | 0 0
  1. Skip to content
  2. Activity
  3. Milestones
  4. Snippets
  5. Search or jump to…
  6. 3
  7. 1
  8.  
  9. S
  10. sjoelGUI
  11. Project
  12. Repository
  13. Files
  14. Commits
  15. Branches
  16. Tags
  17. Contributors
  18. Graph
  19. Compare
  20. Charts
  21. Issues
  22. 0
  23. Merge Requests
  24. 0
  25. CI / CD
  26. Operations
  27. Wiki
  28. Snippets
  29. Settings
  30. Collapse sidebar
  31. L.K.S. Somopawiro
  32. sjoelGUI
  33. Repository
  34. Levi
  35. sjoelgui
  36. adminpage
  37. user adding and edit
  38. index.php
  39.  
  40. Levi Somopawiro's avatar
  41. leaderboard en user bewerking voor admin page
  42. Levi Somopawiro authored 6 days ago
  43. 32fb9e58
  44. index.php 2.54 KB
  45.  
  46. 1
  47. 2
  48. 3
  49. 4
  50. 5
  51. 6
  52. 7
  53. 8
  54. 9
  55. 10
  56. 11
  57. 12
  58. 13
  59. 14
  60. 15
  61. 16
  62. 17
  63. 18
  64. 19
  65. 20
  66. 21
  67. 22
  68. 23
  69. 24
  70. 25
  71. 26
  72. 27
  73. 28
  74. 29
  75. 30
  76. 31
  77. 32
  78. 33
  79. 34
  80. 35
  81. 36
  82. 37
  83. 38
  84. 39
  85. 40
  86. 41
  87. 42
  88. 43
  89. 44
  90. 45
  91. 46
  92. 47
  93. 48
  94. 49
  95. 50
  96. 51
  97. 52
  98. 53
  99. 54
  100. 55
  101. 56
  102. 57
  103. 58
  104. 59
  105. 60
  106. 61
  107. 62
  108. 63
  109. 64
  110. 65
  111. 66
  112. 67
  113. 68
  114. 69
  115. 70
  116. 71
  117. 72
  118. 73
  119. 74
  120. 75
  121. 76
  122. 77
  123. 78
  124. 79
  125. 80
  126. 81
  127. 82
  128. 83
  129. 84
  130. 85
  131. 86
  132. 87
  133. 88
  134. 89
  135. <html>
  136. <head>
  137. <title>adding and editing</title>
  138. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" />
  139. <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
  140. <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
  141. </head>
  142. <body>
  143. <div class="container">
  144. <br />
  145. <br />
  146. <br />
  147. <div class="table-responsive">
  148. <h3 align="center">admin page</a></h3><br />
  149. <span id="result"></span>
  150. <div id="live_data"></div>
  151. </div>
  152. </div>
  153. </body>
  154. </html>
  155. <script>
  156. $(document).ready(function(){
  157. function fetch_data()
  158. {
  159. $.ajax({
  160. url:"select.php",
  161. method:"POST",
  162. success:function(data){
  163. $('#live_data').html(data);
  164. }
  165. });
  166. }
  167. fetch_data();
  168. $(document).on('click', '#btn_add', function(){
  169. var naam = $('#naam').text();
  170. if(naam == '')
  171. {
  172. alert("Enter First Name");
  173. return false;
  174. }
  175. $.ajax({
  176. url:"insert.php",
  177. method:"POST",
  178. data:{naam:naam},
  179. dataType:"text",
  180. success:function(data)
  181. {
  182. alert(data);
  183. fetch_data();
  184. }
  185. })
  186. });
  187.  
  188. function edit_data(id, text, column_name)
  189. {
  190. $.ajax({
  191. url:"edit.php",
  192. method:"POST",
  193. data:{id:id, text:text, column_name:column_name},
  194. dataType:"text",
  195. success:function(data){
  196. //alert(data);
  197. $('#result').html("<div class='alert alert-success'>"+data+"</div>");
  198. }
  199. });
  200. }
  201. $(document).on('blur', '.naam', function(){
  202. var id = $(this).data("id1");
  203. var naam = $(this).text();
  204. edit_data(id, naam, "naam");
  205. });
  206. $(document).on('click', '.btn_delete', function(){
  207. var id=$(this).data("id3");
  208. if(confirm("Are you sure you want to delete this?"))
  209. {
  210. $.ajax({
  211. url:"delete.php",
  212. method:"POST",
  213. data:{id:id},
  214. dataType:"text",
  215. success:function(data){
  216. alert(data);
  217. fetch_data();
  218. }
  219. });
  220. }
  221. });
  222. });
  223. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement