我有这段代码
SELECT a.customer_name ,
a.unit ,
sum(a.price) - sum(b.price) AS "highest revenue" ,
rank() over (partition BY a.unit
ORDER BY sum(a.price) - sum(b.price) DESC) AS "Rank"
FROM
(SELECT customer_name ,
unit ,
price
FROM table1
WHERE booked BETWEEN '12/01/15' AND '12/31/15') a
JOIN
(SELECT customer_name ,
unit ,
price
FROM table1
WHERE booked BETWEEN '11/01/15' AND '11/30/15') b ON a.unit = b.unit
GROUP BY a.customer_name,
a.unit
ORDER BY a.unit,
sum(a.price) - sum(b.price) DESC, rank() over (partition BY a.unit ORDER BY sum(a.price) - sum(b.price) DESC) DESC
问题:检查API响应是否为false如果API响应为真则显示错误消息div继续下一步。
答案 0 :(得分:0)
$.ajax({
type: "POST"
, url: url
, data: JSON.stringify(Login)
, contentType: "application/json",
, success: function (resdata) {
if (resdata == null || resdata == '') {
// handle this error case
} else if (resdata == 'true') {
// handle true case
} else if (resdata == 'false') {
// handle false case
}
}
, error: function () {
// handle error case
}
});
你可以通过返回" true / false"来处理。来自API响应。