Uncaught ReferenceError: alter is not defined
后臺有OTP打印,但是網(wǎng)頁上不顯示,一直報錯Uncaught ReferenceError: alter is not defined?
<html> <head> ????<meta?charset="UTF-8"> ????<script?src="static/assets/global/plugins/jquery-1.11.0.min.js"?type="text/javascript"></script> </head> <body> ????<div> ????????<h3>獲取otp信息</h3> ????????<div> ????????????<label>手機號</label> ????????????<div> ????????????????<input?type="text"?placeholder="手機號"?name="telphone"?id="telphone"/> ????????????</div> ????????</div> ????????<div> ????????????<button?id="getotp"?type="submit"> ????????????????獲取OTP短信 ????????????</button> ????????</div> ????</div> </body> <script> ????jQuery(document).ready(function(){ ????????//綁定otp的click事件用于向后端發(fā)送獲取手機驗證碼的請求 ????????$("#getotp").on("click",function(){ ????????????var?telphone?=?$("#telphone").val(); ????????????if(telphone?==?null?||?telphone==""){ ????????????????alter("手機號不能為空"); ????????????????return?false; ????????????} ????????????$.ajax({ ????????????????type:"POST", ????????????????contentType:"application/x-www-form-urlencoded", ????????????????url:"http://localhost:8090/user/getotp", ????????????????data:{ ????????????????????"telphone":$("#telphone").val(), ????????????????}, ????????????????success:function(data){ ????????????????????if(data.status?==?"success"){ ????????????????????????alter("otp已經(jīng)發(fā)送到您的手機上,請注意查收"); ????????????????????}else?{ ????????????????????????alter("otp發(fā)送失敗,原因為"+data.data.errMsg); ????????????????????} ????????????????}, ????????????????error:function?(data)?{ ????????????????????alter("otp發(fā)送失敗,原因為"+data.responseText); ????????????????} ????????????}); ????????}); ????????return?false; ????}); </script> </html>
2020-08-16
俺也一樣
2020-03-13
解決了,將alter改成alert就好了,這錯誤?