我使用简单的jquery服务调用我总是得到内部服务器错误的原因?请帮我。我给了我的代码。我使用VS2005
给我详细信息
Default.aspx的
<pre><code>
<script src="Scripts/jquery-1.3.2.js" type="text/javascript"></script>
<script type="text/javascript">
function CallService() {
$('input[type=button]').attr('disabled', true);
$("#CustDetails").html('');
$("#CustDetails").addClass("loading");
$.ajax({
type: "POST",
url: "AdvService.asmx/GetCtcDetails",
data: '{}',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: OnSuccess,
error: OnError
});
function OnSuccess(data, status) {
$("#CustDetails").removeClass("loading");
$("#CustDetails").html(data.d);
$('input[type=button]').attr('disabled', false);
}
function OnError(request, status, error) {
$("#CustDetails").removeClass("loading");
$("#CustDetails").html(request.statusText);
$('input[type=button]').attr('disabled', false);
}
}
</script>
身体
<pre><code>
<form id="DocForm" runat="server">
<div>
<table style="width:31%;">
<tr>
<td>
Enter Contact ID</td>
<td>
:</td>
<td>
<input id="txt_id" type="text" />
<input id="btnGo" type="button" value="Get Details" onclick ="CallService(); return false;"/></td>
</tr>
</table>
<br />
<div id="CustDetails" style="width: 60%; height: 75px;">
</div>
</div>
</form>
enter code here
[WebMethod]
public string DisplayMessage()
{
return "Hello World using jQuery Ajax";
}
我使用简单的jquery服务调用我总是得到内部服务器错误的原因?请帮我。我给了我的代码。我使用VS2005
给我详细信息
答案 0 :(得分:0)
@lakshman我不确定我理解你的要求。如果您想将参数传递给服务,您可以像
那样进行操作data: {
id: 123,
name: 'elrado'
}