refer.jvmhost.net/refer247/registration,这是我的url,我需要获取像用户详情这样的请求,并以json
格式获得适当的响应,如果包含状态n错误,则应该有相应的错误信息。请勿提供安卓代码。
这是一个html
页面。
<head>
<script type="text/javascript" src="json2.js"></script>
</head>
<body>
<div data-role="page" data-theme="c">
<div data-role="header" data-position="fixed" data-inset="true" class="paddingRitLft" data-theme="c">
<div data-role="content" data-inset="true"> <a href="index.html" data-direction="reverse"><img src="images/logo_hdpi.png"/></a>
</div>
</div>
<div data-role="content" data-theme="c">
<form name="form" method="post" onsubmit="return validate()">
<div class="logInner">
<div class="logM">Already have an account?</div>
<div class="grouped insert refb">
<div class="ref first">
<div class="input inputWrapper">
<input type="text" data-corners="false" class="inputrefer" placeholder="Userid" name="userid" id="userid" />
</div>
<div class="input inputWrapper">
<input type="password" data-corners="false" class="inputrefer" placeholder="Password" name="password" id="password" />
</div> <a href="dash.html" rel="external" style="text-decoration: none;"><input type="submit" data-inline="true" value="Submit" onclick="json2()"></a>
<p><a href="#" style="text-decoration: none;">Forgot Password</a>
</p>
</div>
</div>
<div class="logM">New user? Create refer Account</div>
<input type="button" class="btnsgreen" value="Sign Up! its FREE" class="inputrefer" data-corners="false" data-theme="c" />
</form>
</div>
</div>
<p style="text-align: center;">© refer247 2013</p>
</div>
</body>
这是json2.js文件
function json2()
{
var json1={"username":document.getElementById('userid').value,
"password":document.getElementById('password').value,
};
//var parsed = jsonString.evalJSON( true );
alert(json1["username"]);
alert(json1["password"]);
};
请告诉我如何将JSON数据发送到该URL并获取一些响应,例如如果使用该ID注册,则已存在电子邮件ID。 然后给出一些错误,例如电子邮件ID已经存在,并且如果成功注册,则给出类似于已成功注册和状态消息的响应..200 okk ...
};
};这是ajax代码...可能包含一些错误...但我不知道...所以请找出并纠正它 - Seenu69