Created
May 20, 2020 12:34
-
-
Save benyaminl/af81f150765e6bb0821c9913ecfb780f to your computer and use it in GitHub Desktop.
Minggu 6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<link rel="stylesheet" type="text/css" href="style.css"> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script> | |
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script> | |
</head> | |
<body> | |
<form method="post" action=""> | |
<ul> | |
<li style="color: white;"><a>11</a></li> | |
<label id="txt_id" style="display:none">1</label> | |
<li><input type="submit" class="btn btn-default" style="color: white; margin-top: 8px;" name="action" value="Home"/></li> | |
<li style="float:right"><input type="submit" class="btn btn-danger" style="margin-top: 7px;" name="action" value="LogOut"/></li> | |
</ul> | |
</form> | |
<!-- add menu --> | |
<h1>List Menu</h1> | |
<input type="submit" id="btn_tambah_menu" class="mt-1 btn btn-success" style="margin-top: 7px;" name="action" value="Add Menu"/> | |
<form method="POST" action=""> | |
<div id="add" class="row" style="width: 500%; margin-left: 1px; padding-left: 50px; background-color: transparent; margin-top: 55px;"> | |
<div class="box" style="width: 650px; margin-left: 10px; padding: 10px;"> | |
</div> | |
</div> | |
</form> | |
<!-- edit --> | |
<form method="POST" action=""> | |
<div id="edit" class="row" style="width: 500%; margin-left: 1px; padding-left: 50px; background-color: transparent; margin-top: 55px;"> | |
<div class="box1" style="width: 650px; margin-left: 10px; padding: 10px;"> | |
</div> | |
</div> | |
</form> | |
<!-- isi mercaht --> | |
<form method="post" action=""> | |
<div class="row" id="isi_merchant"> | |
</div> | |
</form> | |
<script> | |
$(function(){ | |
//btn tambah | |
$("#btn_tambah_menu").click(function(){ | |
var htmltask = `<div class="form-group"> | |
<label for="email">Menu Name :</label> | |
<input type="text" id="nama_menu" class="form-control" name="nama_menu"> | |
</div> | |
<div class="form-group"> | |
<label for="pwd">Menu Price :</label> | |
<input type="text" id="harga_menu" class="form-control" name="harga_menu"> | |
</div> | |
<button type="button" class="btn btn-success" onclick="tambah()">Add</button>` | |
$(".box").append(htmltask); | |
}); | |
}); | |
$("#btn_edit_menu").click(function(){ | |
var htmltask = `<div class="form-group"> | |
<label for="email">Menu Name :</label> | |
<input type="text" class="form-control" id="email" name="nama_menu_b"> | |
</div> | |
<div class="form-group"> | |
<label for="pwd">Menu Price :</label> | |
<input type="text" class="form-control" id="pwd" name="harga_menu_b"> | |
</div> | |
<input type="submit" class="btn btn-info" name="action" value="edit">` | |
$(".box1").append(htmltask); | |
}); | |
function tambah() | |
{ | |
$.post("ajaxmerchant.php", | |
{ | |
jenis:"load_tambah", | |
id: $("#txt_id").html(), | |
nama : $("#nama_menu").val(), | |
harga : $("#harga_menu").val() | |
}, | |
function(data){ | |
alert(data); | |
$.post("ajaxmerchant.php", | |
{ | |
jenis:"load_data", | |
id:$("#txt_id").html() | |
}, | |
function(data){ | |
$("#isi_merchant").html(data); | |
} | |
); | |
} | |
); | |
} | |
$.post("ajaxmerchant.php", | |
{ | |
jenis:"load_data", | |
id : $("#txt_id").html() | |
}, | |
function(data){ | |
$("#isi_merchant").html(data); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment