How get namespace on javascript in asp.net web?

%@ 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 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??

Answer1:

Try

$(document).ready(function () { debugger; var counter = "test"; var service1 = new WebApplication1.Service1(); service1.DoWork(counter, ResultLoadMainGridProductType, ErrorLoadMainGridProductType); });

Also check to make sure that the javascript file jsdebug is in your loaded scripts.

人吐槽 人点赞

Recommend

Comment

用户名: 密码:
验证码: 匿名发表

你可以使用这些语言

查看评论:How get namespace on javascript in asp.net web?