<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html> <head> <title></title> <script type='text/javascript' src='js/jquery-1.11.1.js'></script> </head> <body> <table> <tr> <td> 注册类型: <input type="text" size="50" value="" name="flag" id="flag" /> </td> </tr> <tr> <td> 用户帐号: <input type="text" size="50" value="" name="account" id="account" /> </td> </tr> <tr> <td> 用户密码: <input type="text" size="50" value="" name="passwd" id="passwd"/> </td> </tr> <tr> <td> 用户姓名: <input type="text" size="50" value="" name="name" id="name" /> </td> </tr> <tr> <td> vcode: <input type="text" size="50" value="" name="vcode" id="vcode" /> </td> </tr> <tr> <td> App开发ID: <input type="text" size="50" value="" name="agent" id="agent" /> </td> </tr> <tr> <td align="center"> <input type='button' value='提交' onclick='sendMsg()' /> </td> </tr> </table> </body> <script type="text/javascript"> function sendMsg() { var flag = document.getElementById("flag").value; var account = document.getElementById("account").value; var passwd = document.getElementById("passwd").value; var name = document.getElementById("name").value; var vcode = document.getElementById("vcode").value; var agent = document.getElementById("agent").value; var msg = "{"\"flag\": \""+flag+"\"," + "\"account\":\""+account+"\",\"passwd\":\""+passwd+"\","+ "\"name\":\""+name+"\",\"vcode\":\""+vcode+"\","+ "\"agent\":\""+agent+"\"}"; $.ajax({ type : 'post', url : 'http://222.161.197.250:80/register', data : msg, dataType:'json', contentType: "application/json", success : function(data){ alert("注册成功"); }, error : function(req, textStatus, errorThrown) { console.log(req); if(req.responseJSON!=null){ alert("提交失败,错误编号:" + req.responseJSON.error + "错误原因:" + req.responseJSON.error_desc); }else{ alert("注册成功"); } } }); } </script></html>
デバッグ、var msg = "{""flag": ""+flag+""," + 引用符を追加する必要はありません
印刷方法を教えてくださいページ上でリクエスト情報やフィードバック情報を送信してください