 |
|
<script>
$('#btnLogin').click(function () {
var txtUsername = $("#txtUsername").val();
var txtPassword = $("#txtPassword").val();
$.ajax({
url: 'http://localhost:5000/api/Home/Login',
type: 'POST',
dataType: 'JSON',
data: JSON.stringify({
txtUsername: txtUsername,
txtPassword: txtPassword
}),
contentType: 'application/json',
success: function (res) {
if (res.isCustomer == true) {
console.log("successaaaaaaaaaaa",res.isCustomer);
Swal.fire({
title: '<strong><u>Wellcome User </u></strong>',
icon: 'info',
html: res.message,
// html:
// '<p>Name : ' + res.nameEng + '</p>' +
// '<p>Position : ' + res.positionNameEng + '</p>' +
// '<p>Staff Level : ' + res.staffNameEng + '</p>' +
// '<p>Division : ' + res.divisionNameEng + '</p>',
confirmButtonText: '<i class="fas fa-user-check"></i> OK',
}).then((result) => {
if (result.value) {
window.location = "user_index.php";
}
})
}
else {
console.log("warning",res);
Swal.fire({
title: '<strong><u>Wellcome Technician </u></strong>',
icon: 'warning',
html: res.message,
confirmButtonText: '<i class="fas fa-skull-crossbones"></i> OK',
}).then((result) => {
if (result.value) {
window.location = "tech/index.php";
}
})
}
},
failure: function (res) {
Swal.fire({
title: '<strong><u>Error</u></strong>',
icon: 'error',
html: res.message,
confirmButtonText: '<i class="fas fa-skull-crossbones"></i> OK',
}).then((result) => {
if (result.value) {
window.location = "logintest.php";
}
})
},
});
});
</script>
จากสคิปหน้าLogin อยากทราบวิธีให้ข้อมูลข้อ user ที่Loginเข้ามา ส่งข้อมูลไปยังหน้าDashboardของuserคนนั้นๆด้วยครับ ตัวอย่าเช่นชื่อ Username เพื่อรุบะว่าเป็นใคร จะมีสคิปไหนที่สามารถรับค่าไปหน้าdashboardได้มั่งครับ
Tag : PHP, Ms SQL Server 2016, Ajax, jQuery
|
|
 |
 |
 |
 |
Date :
2020-12-16 01:19:39 |
By :
alphatize13 |
View :
807 |
Reply :
3 |
|
 |
 |
 |
 |
|
|
|
 |