%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<script type="text/javascript" src="Scripts/jquery-1.4.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
debugger;
var counter = "test";
WebApplication1.Service1.DoWork(counter, ResultLoadMainGridProductType, ErrorLoadMainGridProductType);
});
function ResultLoadMainGridProductType() {
}
function ErrorLoadMainGridProductType() {
}
</script>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager" runat="server">
<Services>
<asp:ServiceReference Path="~/Service1.svc" />
</Services>
</asp:ScriptManager>
</div>
</form>
</body>
</html>
代碼失敗WebApplication1.Service1.DoWork(counter, ResultLoadMainGridProductType, ErrorLoadMainGridProductType);
錯誤:Microsoft Jscript的實現錯誤:「WebApplication1」不確定。 WebApplication1 - 命名空間...然後我看它在JavaScript代碼工作未定義。 如何讓它在那裏?如何在asp.net web上獲取JavaScript上的命名空間?
WebApplication1.Service1.DoWork是一種服務器端方法嗎? –