如何发送用户名和密码并获得结果?

问题描述:

以下是基本表格代码



Below is a basic form code

<form method="post" name="testform" >
<div>
<label><strong>Username</strong>
<input type="text" id="username" />
</label>
<br />
<label><strong>Password</strong>
<input type="password" id="password" />
</label>
<br />
<input type="submit" value="Log in"  />
<input type="reset" value="clear"  />
</div>
</form>





我想要什么是发送用户名和密码,比如gmail.com,它应该打印

登录成功

如果用户名和密码是正确的。

因为我是HTML的新手,所以我不知道该怎么做。可以用javascript完成吗?

请帮助。



what i want is to send username and password to, say gmail.com, and it should print
LOGIN SUCCESS
if the username and password are correct.
Since I am new to HTML so i dont know how to do it. And can it be done with javascript ?
please help.

你可以尝试使用jQuery下面的内容。



You can try something is like below with jQuery.


.ajax({
type:POST,
url:你的网址在这里,
数据:{用户名:
.ajax({ type: "POST", url: "Your url here", data: { username:


('#username'),密码:
('#username'), password: