<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Webmethod &#8211; Sibeesh Passion</title>
	<atom:link href="https://mail.sibeeshpassion.com/tag/webmethod/feed/" rel="self" type="application/rss+xml" />
	<link>https://mail.sibeeshpassion.com</link>
	<description>My passion towards life</description>
	<lastBuildDate>Wed, 02 Jun 2021 15:17:26 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>/wp-content/uploads/2017/04/Sibeesh_Passion_Logo_Small.png</url>
	<title>Webmethod &#8211; Sibeesh Passion</title>
	<link>https://mail.sibeeshpassion.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Calling a Webmethod Using Jquery Ajax</title>
		<link>https://mail.sibeeshpassion.com/calling-a-webmethod-using-jquery-ajax/</link>
					<comments>https://mail.sibeeshpassion.com/calling-a-webmethod-using-jquery-ajax/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Sun, 31 May 2015 13:12:00 +0000</pubDate>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Blog]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Ajax]]></category>
		<category><![CDATA[Calling Webmethod]]></category>
		<category><![CDATA[JQuery Ajax]]></category>
		<category><![CDATA[Webmethod]]></category>
		<guid isPermaLink="false">https://sibeeshpassion.com/?p=2941</guid>

					<description><![CDATA[Introduction This tip explains how to call a web method using JQuery.There are so many ways we can do this requirement. Here I am explaining one. Steps We need to include: [js] &#60;script src=&#34;Script/jquery-1.9.1.min.js&#34; type=&#34;text/javascript&#34;&#62;&#60;/script&#62; [/js] After that, create an Ajax jQuery function like this: [js] function checkUserNameAvail() { var userid = $(&#34;#reguser&#34;).val(); jQuery.ajax({ type: &#34;POST&#34;, url: &#34;Login.aspx/checkUserNameAvail&#34;, //It calls our web method contentType: &#34;application/json; charset=utf-8&#34;, data: &#34;{&#8216;iuser&#8217;:&#8217;&#34; + userid + &#34;&#8217;}&#34;, dataType: &#34;xml&#34;, success: function (msg) { $(msg).find(&#34;Table&#34;).each(function () { var username = $(this).find(&#8216;UserName&#8217;).text(); if (username != &#8221;) { //window.location.replace(&#8216;/iCalendar.aspx&#8217;); alert(&#8216;This username already taken..&#8217;); $(&#34;#reguser&#34;).val(&#8221;); $(&#34;#reguser&#34;).focus(); } else { [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><strong>Introduction</strong></p>
<p>This tip explains how to call a web method using JQuery.There are so many ways we can do this requirement. Here I am explaining one. </p>
<p><strong>Steps</strong></p>
<p>We need to include:<br />
[js]<br />
&lt;script src=&quot;Script/jquery-1.9.1.min.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;<br />
[/js]</p>
<p>After that, create an Ajax jQuery function like this:<br />
[js]<br />
function checkUserNameAvail() {<br />
    var userid = $(&quot;#reguser&quot;).val();<br />
    jQuery.ajax({<br />
        type: &quot;POST&quot;,<br />
        url: &quot;Login.aspx/checkUserNameAvail&quot;, //It calls our web method<br />
        contentType: &quot;application/json; charset=utf-8&quot;,<br />
        data: &quot;{&#8216;iuser&#8217;:&#8217;&quot; + userid + &quot;&#8217;}&quot;,<br />
        dataType: &quot;xml&quot;,<br />
        success: function (msg) {<br />
            $(msg).find(&quot;Table&quot;).each(function () {<br />
                var username = $(this).find(&#8216;UserName&#8217;).text();<br />
                if (username != &#8221;) {<br />
                    //window.location.replace(&#8216;/iCalendar.aspx&#8217;);<br />
                    alert(&#8216;This username already taken..&#8217;);<br />
                    $(&quot;#reguser&quot;).val(&#8221;);<br />
                    $(&quot;#reguser&quot;).focus();<br />
                }<br />
                else {<br />
                }<br />
            });<br />
        },<br />
        error: function (d) {<br />
        }<br />
    });<br />
}<br />
[/js]</p>
<p>Make sure that you have included the js file to the aspx page.</p>
<p>Create a web method in your aspx.cs file like the following:<br />
[csharp]<br />
[WebMethod(enableSession: true)]<br />
   [ScriptMethod(ResponseFormat = ResponseFormat.Xml)]<br />
   public static string checkUserNameAvail(string iuser)<br />
   {<br />
       try<br />
       {<br />
           //This is where i am returning my data from DB  </p>
<p>           iCalendarClass iC = new iCalendarClass();<br />
           DataSet ds = iC.checkUserNameAvail(iuser);<br />
           return (ds.GetXml());<br />
       }<br />
       catch<br />
       {<br />
           return null;<br />
       }<br />
   }<br />
[/csharp]<br />
Make sure that your function returns XML.</p>
<p>That&#8217;s all. Have a happy coding 🙂</p>
]]></content:encoded>
					
					<wfw:commentRss>https://mail.sibeeshpassion.com/calling-a-webmethod-using-jquery-ajax/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
