|
@@ -113,12 +113,25 @@ $(".next").click(function () {
|
|
xhr.setRequestHeader("Content-Type", "application/json");
|
|
xhr.setRequestHeader("Content-Type", "application/json");
|
|
xhr.onreadystatechange = function () {
|
|
xhr.onreadystatechange = function () {
|
|
if (xhr.readyState === 4) {
|
|
if (xhr.readyState === 4) {
|
|
- Swal.fire({
|
|
|
|
- title: "資料已送出",
|
|
|
|
- icon: 'success',
|
|
|
|
- text: '資料已傳送,請耐心等候',
|
|
|
|
- confirmButtonColor: '#3085d6',
|
|
|
|
- });
|
|
|
|
|
|
+ responseOBJ = JSON.parse(xhr.responseText)
|
|
|
|
+ if (responseOBJ.msg=='ok')
|
|
|
|
+ {
|
|
|
|
+ Swal.fire({
|
|
|
|
+ title: "資料已送出",
|
|
|
|
+ icon: 'success',
|
|
|
|
+ text: '資料已傳送,請耐心等候',
|
|
|
|
+ confirmButtonColor: '#3085d6',
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ else{
|
|
|
|
+ Swal.fire({
|
|
|
|
+ title: "發生錯誤",
|
|
|
|
+ icon: 'error',
|
|
|
|
+ text: responseOBJ.msg,
|
|
|
|
+ confirmButtonColor: '#3085d6',
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|
|
};
|
|
};
|
|
var data = renderXHR_data(dataOBJ)
|
|
var data = renderXHR_data(dataOBJ)
|
|
@@ -160,30 +173,31 @@ $("#sendBTN").click(function () {
|
|
xhr.setRequestHeader("Authorization","Bearer "+jwt_token)
|
|
xhr.setRequestHeader("Authorization","Bearer "+jwt_token)
|
|
xhr.setRequestHeader("Content-Type", "application/json");
|
|
xhr.setRequestHeader("Content-Type", "application/json");
|
|
xhr.onreadystatechange = function () {
|
|
xhr.onreadystatechange = function () {
|
|
-
|
|
|
|
|
|
+ if (xhr.readyState === 4) {
|
|
|
|
+ responseOBJ = JSON.parse(xhr.responseText)
|
|
|
|
+ if (responseOBJ.msg=='ok')
|
|
|
|
+ {
|
|
|
|
+ Swal.fire({
|
|
|
|
+ title: "資料已送出",
|
|
|
|
+ icon: 'success',
|
|
|
|
+ text: '資料已傳送,請耐心等候',
|
|
|
|
+ confirmButtonColor: '#3085d6',
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ else{
|
|
|
|
+ Swal.fire({
|
|
|
|
+ title: "發生錯誤",
|
|
|
|
+ icon: 'error',
|
|
|
|
+ text: responseOBJ.msg,
|
|
|
|
+ confirmButtonColor: '#3085d6',
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
};
|
|
};
|
|
var data = renderXHR_data(dataOBJ)
|
|
var data = renderXHR_data(dataOBJ)
|
|
console.log(data)
|
|
console.log(data)
|
|
result = xhr.send(objstr);
|
|
result = xhr.send(objstr);
|
|
- console.log(result)
|
|
|
|
- if (result !='ok') {
|
|
|
|
- Swal.fire({
|
|
|
|
- title: "資料已送出",
|
|
|
|
- icon: 'success',
|
|
|
|
- text: '資料已傳送,請耐心等候',
|
|
|
|
- confirmButtonColor: '#3085d6',
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- else{
|
|
|
|
-
|
|
|
|
- Swal.fire({
|
|
|
|
- title: '發生錯誤',
|
|
|
|
- icon: 'error',
|
|
|
|
- text: result.msg,
|
|
|
|
- confirmButtonColor: '#3085d6',
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
});
|
|
});
|
|
|
|
|
|
const slide_button = document.querySelector('#send_slide');
|
|
const slide_button = document.querySelector('#send_slide');
|