在asp.net网站的JavaScript如何获得命名空间? [英] How get namespace on javascript in asp.net web?
本文介绍了在asp.net网站的JavaScript如何获得命名空间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
%@ 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>
;
code对 WebApplication1.Service1.DoWork(计数器,ResultLoadMainGridProductType,ErrorLoadMainGridProductType)失败
错误:实现微软的Jscript的错误:WebApplication1是不是一定。
WebApplication1 - 命名空间...然后我看着它,它未定义JavaScript的code工作。
如何让它在那里?
Code fails on WebApplication1.Service1.DoWork(counter, ResultLoadMainGridProductType, ErrorLoadMainGridProductType);
Error: Error of implementation of Microsoft Jscript: "WebApplication1" is not certain.
WebApplication1 - the namespace... then I watch it it undefined on javascript code working.
How make it be there??
推荐答案
尝试
$(document).ready(function () {
debugger;
var counter = "test";
var service1 = new WebApplication1.Service1();
service1.DoWork(counter, ResultLoadMainGridProductType, ErrorLoadMainGridProductType);
});
还检查以确保JavaScript文件 jsdebug
在你加载的脚本。
这篇关于在asp.net网站的JavaScript如何获得命名空间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文