-
Notifications
You must be signed in to change notification settings - Fork 0
/
myshop.js
53 lines (52 loc) · 1.45 KB
/
myshop.js
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
$(document).ready(function() {
$("#priceBtn").click(function() {
if ($(this).text() == "Edit") {
$("#price").attr("disabled", false);
$("#priceBtn").text("Send");
}
else {
$.ajax({
// url:"/modify_shop.php",
url:"modify_shop.php",
data:{ "price": $("#price").val() },
method:"POST",
type:"POST",
dataType: 'json',
// error: function(jqxhr, status, reason) {
// alert('error: ' + reason);
// },
success: function(response) {
var jsonData = JSON.parse(response);
// alert('returned from php');
// alert(jsonData.success);
// if(data.success == '1') alert('Update mask price successfully.');
// else alert('Update mask price failed. ')
}
});
$("#price").attr("disabled", true);
$("#priceBtn").text("Edit");
}
});
$("#amountBtn").click(function(){
if ($(this).text() == "Edit"){
$("#amount").attr("disabled", false);
$("#amountBtn").text("Send");
}
else {
$.ajax({
url:"modify_shop.php",
data:{ "amount": $("#amount").val() },
method:"POST",
type:"POST",
dataType: 'json',
success:function(data) {
if(data.success == "1") alert("Update mask amount successfully.");
// if(data.success > 0) alert('Update mask amount successfully.');
else alert('Update mask amount failed. ')
}
});
$("#amount").attr("disabled", true);
$("#amountBtn").text("Edit");
}
});
});