title: How call WCF service from javascript?
body: <p>I have a WCF service in folder "Services":</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Runtime.Serialization;
  using System.ServiceModel;
  using System.Text;
  using System.Web.Services;
  using System.ServiceModel.Activation;
  using System.Web.Script.Services;
  
  namespace Application.Services
  {
      [ServiceContract]
      [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
      [ScriptService]    
      public class ProductTypeService
      {
          [OperationContract]
          [WebMethod]
          public string LoadMainGridProductType(string test)
          {
              return "Success";
          }
      }
  }
  </code></pre>
  
  <p>and on page I try to call this service method from javascript:</p>
  
  <pre><code>$(document).ready(function () {
      var counter = "test";    
      Application.Services.ProductTypeService.LoadMainGridProductType(counter, ResultLoadMainGridProductType, ErrorLoadMainGridProductType);
  });
  </code></pre>
  
  <p>on page I also make conect to this service and javascript files:</p>
  
  <pre><code>&lt;asp:ScriptManager ID="ScriptManager" runat="server"&gt;
              &lt;Scripts&gt;
                  &lt;asp:ScriptReference Path="~/Scripts/ProductType.js" /&gt;
              &lt;/Scripts&gt;
              &lt;Services&gt;
                  &lt;asp:ServiceReference Path="~/Services/ProductTypeService.svc" /&gt;        
              &lt;/Services&gt;
          &lt;/asp:ScriptManager&gt;
  </code></pre>
  
  <p>but code fails on </p>
  
  <pre><code>Application.Services.ProductTypeService.LoadMainGridProductType(counter, ResultLoadMainGridProductType, ErrorLoadMainGridProductType);
  </code></pre>
  
  <p>Error : Error of implementation of Microsoft Jscript: "Application" is not certain.
  How fix this???</p>