ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2019 www.aspforums.com. All rights reserved.[Solved] jQuery AJAX WebMethod not getting called in ASP.Net<p>Hi&nbsp;<a class="username" rel="Sumeet">Sumeet,</a></p> <blockquote><cite>Sumeet says:</cite> <pre>data: '{doy: "' + doy + '", route: Baltal}',</pre> </blockquote> <p>Here you need to pass string value to route parameter.</p> <p>Check this example. Now please take its reference and correct your code.</p> <p><strong><span style="text-decoration: underline;">HTML</span></strong></p> <pre class="brush: html">&lt;script src=&#34;http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js&#34; type=&#34;text/javascript&#34;&gt;&lt;/script&gt; &lt;script type=&#34;text/javascript&#34;&gt; $(document).ready(function () { $(&#39;#txtdoy&#39;).change(function () { var doy = $(this).val(); $.ajax({ type: &#34;POST&#34;, url: &#34;Default.aspx/GetRouteQuota&#34;, data: &#39;{doy: &#34;&#39; + doy + &#39;&#34;, route: &#34;Baltal&#34;}&#39;, contentType: &#34;application/json; charset=utf-8&#34;, dataType: &#34;json&#34;, success: function (response) { alert(response.d); }, error: function (response) { alert(response.d); }, failure: function (response) { alert(response.d); } }); }); }); &lt;/script&gt; &lt;AjaxControls:ToolkitScriptManager ID=&#34;ToolkitScriptManager1&#34; runat=&#34;server&#34; EnablePageMethods=&#34;true&#34;&gt; &lt;/AjaxControls:ToolkitScriptManager&gt; &lt;asp:TextBox ID=&#34;txtdoy&#34; runat=&#34;server&#34; Font-Size=&#34;Small&#34; Width=&#34;150px&#34; MaxLength=&#34;11&#34;&gt;&lt;/asp:TextBox&gt; &lt;AjaxControls:CalendarExtender ID=&#34;CalendarExtender1&#34; runat=&#34;server&#34; Format=&#34;dd/MMM/yyyy&#34; TargetControlID=&#34;txtdoy&#34;&gt; &lt;/AjaxControls:CalendarExtender&gt; &lt;/div&gt;</pre> <p><strong><span style="text-decoration: underline;">C#</span></strong></p> <pre class="brush: csharp">[System.Web.Services.WebMethod()] public static string GetRouteQuota(DateTime doy, string route) { string rstr = &#34;&#34;; rstr = &#34;Date of Yatra: &#34; + doy.ToString() + &#34;, Route: &#34; + route; return rstr; }</pre> <p><strong>VB.Net</strong></p> <pre class="brush: csharp">&lt;System.Web.Services.WebMethod()&gt; _ Public Shared Function GetRouteQuota(ByVal doy As Date, ByVal route As String) As String Dim rstr As String = &#34;&#34; rstr = &#34;Date of Yatra: &#34; &amp; doy.ToString() &amp; &#34;, Route: &#34; &amp; route Return rstr End Function</pre> <p><strong><span style="text-decoration: underline;">Screenshot</span></strong></p> <p><strong><span style="text-decoration: underline;"><img src="https://i.imgur.com/e0N7Mgp.gif" alt="" width="367" height="285" /></span></strong></p>https://www.aspforums.net:443/Threads/124693/Solved-jQuery-AJAX-WebMethod-not-getting-called-in-ASPNet/https://www.aspforums.net:443/Threads/124693/Solved-jQuery-AJAX-WebMethod-not-getting-called-in-ASPNet/Wed, 13 Mar 2019 01:55:06 GMT