zJianFlys的留言板

zJianFlys 2020-01-02 06:36:31
大家好,这里是我的留言板,如果有问题,欢迎大家留言,我会第一时间进行回复
...全文
73 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
weixin_45000294 2020-03-18
  • 打赏
  • 举报
回复
ajax通讯不成功呢 一直返回 error 下面是我的代码 <!DOCTYPE html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> <meta name="format-detection" content="telephone=no"/> <link rel="stylesheet" type="text/css" href="css/login.css"> <title>Sign In</title> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="jquery.form.js"></script> <script type="text/javascript" > $(function(){ }) function onSubmit(){ var username = $("#account").val(); var password = $("#password").val(); $.ajax({ //请求方式 type : "POST", //请求地址 url : "user/login", dataType:"json", //数据,json字符串 data : { "username":username, "password":password }, //请求成功 success : function(data) {alert("okk"); //将字符串装为json //var dataObj = eval('('+data.data+')'); //alert(dataObj.username); }, //请求失败,包含具体的错误信息 error : function(e){ alert("error"); //console.log(e.status); //console.log(e.responseText); } }); } </script> </head> <body class="sec_body"> <div class="center_father"> <h1 class="center" style="margin:0 0;font-size:x-large;padding:0;">Sign In</h1> </div> <!--<form id="form1" method="post" action="/user/login">--> <form id="form1" method="post" action="/user/login"> <table align="center" cellpadding="0" cellspacing="0"> <tr> <td width="100" align="right">Account:  </td> <td width="276"><input name="account" type="text" id="account" value="123"/></td> </tr> <tr> <td width="100">  </td> <td width="276">  </td> </tr> <tr> <td align="right">Password:  </td> <td><input name="password" type="password" id="password" value="123"/></td> </tr> <tr> <td width="100">  </td> <td width="276">  </td> </tr> <tr> <td colspan="2" align="center"> <input type="submit" name="Submit" value="提交"/> </td> </tr> </table> <p>Account: 123, Password: 123</p> <p><input type="button" value="登录" onclick="onSubmit()"> </form> </body> </html>

590

社区成员

发帖
与我相关
我的任务
社区描述
提出问题
其他 技术论坛(原bbs)
社区管理员
  • community_281
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧