我在 html 页面中有一个表单,我尝试使用 AJAX 来捕获响应,但不知何故我没有将请求发送到服务器。我哪里错了?
<html>
<head>
<script>
$(function() {
$(".button").click(function() {
var clin=$("input#client").val();
var us=$("input#username").val();
var dataString='client='+clin+'&username='+us;
$.ajax({
type: "POST",
url: "http://localhost:8080/services/web?wsdl/authen",
data: dataString,
success: function(response) {
alert("The server says: " + response);
}
});
return false;
});
});
</script>
</head>
<body>
<div id="myform">
<form name="frm1">
<table>
Enter Your User Account:
<tr>
<td>Client ID</td>
<td>
<input class="text-input" type="text" size="30" name="client" id="client">
</td>
</tr>
<tr>
<td>User ID</td>
<td>
<input class="text-input" type="text" size="30" name="username" id="username">
</td>
</tr>
<tr>
<td></td>
<td align="right">
<input type="submit" name="submit" value="get" class="button" id="submit_btn">
</td>
</tr>
</table>
</form>
</div>
</body>
</html>
我想在 AJAX 中捕获表单响应,但不确定我是否正确?
我提供我的服务器网络服务:
xs:element name="authen"> <br>
xs:complexType> <br>
xs:sequence> <br>
xs:element name="ClientID" type="xs:string" nillable="true" minOccurs="0"/> <br>
xs:element name="UserID" type="xs:string" nillable="true" minOccurs="0"/> <br>
/xs:sequence><br>
/xs:complexType><br>
/xs:element><br>
xs:element name="authenResponse"><br>
xs:complexType><br>
xs:sequence><br>
xs:element name="return" type="xs:string" nillable="true" minOccurs="0"/><br>
xs:sequence><br>
xs:complexType><br>
xs:element><br>