尝试获取Ajax.post失败的原因(使用Scala.Js),但仅获取类名:
Ajax.post(
url = "...",
data = "...",
headers = Map("Content-Type"->"application/json; charset=utf-8",
"Csrf-Token" -> "...")
).map(_.responseText).map(
content => content match {
case _ => ...
}
).onFailure {
case err => log.info(s"failure ${err.toString} ${err.getCause} ${err.getMessage}")
}
我得到:
failure org.scalajs.dom.ext.AjaxException null null
是否可以找到原因? 谢谢
答案 0 :(得分:0)
我不这么认为。由于AjaxException
的原因无法构建:
case class AjaxException(xhr: dom.XMLHttpRequest) extends Exception {
def isTimeout = xhr.status == 0 && xhr.readyState == 4
}