function fn_item_list() {
$.ajax({
type: "GET",
xhrFields: {
withCredentials: true
},
headers: {
'Authorization': 'Basic ' + 'admin:123'
//'Authorization': 'Basic ' + btoa('admin:123')
},
url: "/api/Customers_",
data: {
cust_name: $("#cust_names").val()
},
success: function (data) {
//alert(data);
$("#div_item1 table tbody").empty();
//var dt = JSON.parse(data);
var dt = data;
//alert(jsonObj.length);
for (var i = 0; i < dt.length; i++) {
var sql = "<tr>";
sql += " <td>" + dt[i].cust_code + "</td>";
sql += " <td>" + dt[i].cust_name + "</td>";
sql += " <td onclick=fn_Edit('" + dt[i].cust_code + "') class='btn btn-success' ><i class='fa fa-trash' aria-hidden='true'></i></td>";
sql += " <td onclick=fn_Delete('" + dt[i].cust_code + "') class='btn btn-danger' ><i class='fa fa-trash' aria-hidden='true'></i></td>";
sql += "</tr>";
$("#div_item1 table tbody").append(sql);
}
},
error: function (data) {
alert("error : " + data);
},
failed: function (data) {
alert("failed : " + data);
}
});
};
$.ajax({
type: "GET",
xhrFields: {
withCredentials: true
},
headers: {
'Authorization': 'Basic ' + 'admin:123'
//'Authorization': 'Basic ' + btoa('admin:123')
},
url: "/api/Customers_",
data: {
cust_name: $("#cust_names").val()
},
success: function (data) {
//alert(data);
$("#div_item1 table tbody").empty();
//var dt = JSON.parse(data);
var dt = data;
//alert(jsonObj.length);
for (var i = 0; i < dt.length; i++) {
var sql = "<tr>";
sql += " <td>" + dt[i].cust_code + "</td>";
sql += " <td>" + dt[i].cust_name + "</td>";
sql += " <td onclick=fn_Edit('" + dt[i].cust_code + "') class='btn btn-success' ><i class='fa fa-trash' aria-hidden='true'></i></td>";
sql += " <td onclick=fn_Delete('" + dt[i].cust_code + "') class='btn btn-danger' ><i class='fa fa-trash' aria-hidden='true'></i></td>";
sql += "</tr>";
$("#div_item1 table tbody").append(sql);
}
},
error: function (data) {
alert("error : " + data);
},
failed: function (data) {
alert("failed : " + data);
}
});
};
No comments:
Post a Comment