0
我想發送一個get方法來查找服務器日期,然後獲取該變量的值並在程序的後半部分使用它們,但每次我使用按照以下方式執行代碼的後半部分。如何阻止這一點?
var syncedDate;
$http.get("../../system/info").then(function (response) {
response = response.data;
syncedDate = response.serverDate.split("T")[0] + " (" + response.serverDate.split("T")[1].split(".")[0] + ")";
console.log(syncedDate);
});
if (respo == "error") {
syncHistory.push({
syncDate: syncedDate,
notification: "Error In Network",
instance: instance,
metaDataFilterd: filData,
response: respo
})