Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Skip to content
- Activity
- Milestones
- Snippets
- Search or jump to…
- 3
- 1
- S
- sjoelGUI
- Project
- Repository
- Files
- Commits
- Branches
- Tags
- Contributors
- Graph
- Compare
- Charts
- Issues
- 0
- Merge Requests
- 0
- CI / CD
- Operations
- Wiki
- Snippets
- Settings
- Collapse sidebar
- L.K.S. Somopawiro
- sjoelGUI
- Repository
- Levi
- sjoelgui
- adminpage
- user adding and edit
- index.php
- Levi Somopawiro's avatar
- leaderboard en user bewerking voor admin page
- Levi Somopawiro authored 6 days ago
- 32fb9e58
- index.php 2.54 KB
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- <html>
- <head>
- <title>adding and editing</title>
- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" />
- <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
- </head>
- <body>
- <div class="container">
- <br />
- <br />
- <br />
- <div class="table-responsive">
- <h3 align="center">admin page</a></h3><br />
- <span id="result"></span>
- <div id="live_data"></div>
- </div>
- </div>
- </body>
- </html>
- <script>
- $(document).ready(function(){
- function fetch_data()
- {
- $.ajax({
- url:"select.php",
- method:"POST",
- success:function(data){
- $('#live_data').html(data);
- }
- });
- }
- fetch_data();
- $(document).on('click', '#btn_add', function(){
- var naam = $('#naam').text();
- if(naam == '')
- {
- alert("Enter First Name");
- return false;
- }
- $.ajax({
- url:"insert.php",
- method:"POST",
- data:{naam:naam},
- dataType:"text",
- success:function(data)
- {
- alert(data);
- fetch_data();
- }
- })
- });
- function edit_data(id, text, column_name)
- {
- $.ajax({
- url:"edit.php",
- method:"POST",
- data:{id:id, text:text, column_name:column_name},
- dataType:"text",
- success:function(data){
- //alert(data);
- $('#result').html("<div class='alert alert-success'>"+data+"</div>");
- }
- });
- }
- $(document).on('blur', '.naam', function(){
- var id = $(this).data("id1");
- var naam = $(this).text();
- edit_data(id, naam, "naam");
- });
- $(document).on('click', '.btn_delete', function(){
- var id=$(this).data("id3");
- if(confirm("Are you sure you want to delete this?"))
- {
- $.ajax({
- url:"delete.php",
- method:"POST",
- data:{id:id},
- dataType:"text",
- success:function(data){
- alert(data);
- fetch_data();
- }
- });
- }
- });
- });
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement