【发布时间】:2018-01-08 10:22:50
【问题描述】:
如何使用 laravel 和 AMP 从服务器呈现错误/成功消息,这里是一个示例,但它不起作用我得到未定义的变量
服务器端(laravel)
public function userAjaxHasNotLogedIn()
{
return response()->json(['loged' => false], 400)
->header('AMP-Access-Control-Allow-Source-Origin',"http://localhost:8000");
}
函数工作正常,它返回一个带有变量 loged 的 json 文件
客户端 (AMP)
<div submit-error>
<template type="amp-mustache">
<a style="cursor: pointer;" id="submitloginbtn" on="tap:loginform.show,submitloginbtn.hide" > Réessayer </a>
</template>
</div><div submit-success>
<template type="amp-mustache">Vous êtes connecté {{ loged }}</template></div>
错误使用未定义的常量已记录 - 假定为“已记录”
【问题讨论】:
-
在查询中添加json数据会更好。
-
没看懂,请解释一下