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.Binding Label from WebMethod using jQuery AJAX in ASP.Net<p>Hi <a class="username" rel="nauna"> nauna</a>,</p> <p>1. You are binding the response in the failure function. You need to bind it in success function.</p> <p>2. When assigning the value to label you can't use <span style="text-decoration: underline;">val</span> method to assigh the value. You have to use <span style="text-decoration: underline;">html</span> method.</p> <p>3. You need to use the JSON attribute as returned by the json string. This is case sensitive. So you need to use the same what is returned by the response i.e. in this case you have to use <span style="text-decoration: underline;">Id</span> and <span style="text-decoration: underline;">Name</span> instead of <span style="text-decoration: underline;">id</span> and <span style="text-decoration: underline;">name</span>.</p> <p>Check the modified code.</p> <pre class="brush: js">&lt;script type=&#34;text/javascript&#34;&gt; $(function () { $(&#39;[id*=txtSearch]&#39;).on(&#39;blur&#39;, function () { $.ajax({ type: &#34;POST&#34;, url: &#34;Default2.aspx/GetPersonDetails&#34;, data: &#39;{name: &#34;&#39; + $(&#34;#&lt;%=txtSearch.ClientID%&gt;&#34;)[0].value + &#39;&#34; }&#39;, contentType: &#34;application/json; charset=utf-8&#34;, dataType: &#34;json&#34;, success: function (response) { var user = JSON.parse(response.d); $(&#34;[id*=lblId]&#34;).html(user.Id); $(&#39;[id*=lblName]&#39;).html(user.Name); }, failure: function (response) { alert(response.responseText) }, error: function (response) { alert(response.responseText) } }); }); }); &lt;/script&gt;</pre>https://www.aspforums.net:443/Threads/712820/Binding-Label-from-WebMethod-using-jQuery-AJAX-in-ASPNet/https://www.aspforums.net:443/Threads/712820/Binding-Label-from-WebMethod-using-jQuery-AJAX-in-ASPNet/Fri, 31 Aug 2018 00:14:00 GMT