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.ASP.Net jQuery AJAX Error: Guid should contain 32 digits with 4 dashes<p>Hi <a class="username" rel="nauna"> nauna</a>,</p> <p>Refer below sample.</p> <p><span style="text-decoration: underline;"><strong>HTML</strong></span></p> <pre class="brush: html">&lt;html xmlns=&#34;http://www.w3.org/1999/xhtml&#34;&gt; &lt;head id=&#34;Head1&#34; runat=&#34;server&#34;&gt; &lt;title&gt;&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;form id=&#34;form1&#34; runat=&#34;server&#34;&gt; &lt;script type=&#34;text/javascript&#34; src=&#34;http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js&#34;&gt;&lt;/script&gt; &lt;script type=&#34;text/javascript&#34; src=&#34;http://cdn.jsdelivr.net/json2/0.1/json2.js&#34;&gt;&lt;/script&gt; &lt;script type=&#34;text/javascript&#34;&gt; $(function () { $(&#34;[id*=LinkButton1]&#34;).bind(&#34;click&#34;, function () { var username = &#39;&lt;%=@HttpContext.Current.User.Identity.Name%&gt;&#39;; var projectid = createGuid(); $.ajax({ type: &#34;POST&#34;, url: &#34;Default.aspx/insertbid&#34;, data: &#34;{username: &#39;&#34; + username + &#34;&#39;, projectid: &#39;&#34; + projectid + &#34;&#39;}&#34;, contentType: &#34;application/json; charset=utf-8&#34;, dataType: &#34;json&#34;, success: function (response) { alert(response.responseText); }, error: function (response) { alert(response.responseText); }, failure: function (response) { alert(response.responseText); } }); return false; }); }); function createGuid() { return &#39;xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx&#39;.replace(/[xy]/g, function (c) { var r = Math.random() * 16 | 0, v = c === &#39;x&#39; ? r : (r &amp; 0x3 | 0x8); return v.toString(16); }); } &lt;/script&gt; &lt;asp:LinkButton ID=&#34;LinkButton1&#34; runat=&#34;server&#34;&gt;Submit&lt;/asp:LinkButton&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt;</pre> <p><span style="text-decoration: underline;"><strong>Namespaces</strong></span></p> <p>&nbsp;</p> <pre class="brush: csharp">using System.Web.Services;</pre> <p><span style="text-decoration: underline;"><strong>Code</strong></span></p> <pre class="brush: csharp">[WebMethod] public static string insertbid(string username, Guid projectid) { if (!string.IsNullOrEmpty(username)) { string getuser = username; } return string.Format(&#34;{0},{1}&#34;, username, projectid); }</pre> <p>You need to generate guid refer below link to generate guid.</p> <p><a href="https://www.c-sharpcorner.com/blogs/generate-guid-using-javascript1">https://www.c-sharpcorner.com/blogs/generate-guid-using-javascript1</a></p>https://www.aspforums.net:443/Threads/149512/ASPNet-jQuery-AJAX-Error-Guid-should-contain-32-digits-with-4-dashes/https://www.aspforums.net:443/Threads/149512/ASPNet-jQuery-AJAX-Error-Guid-should-contain-32-digits-with-4-dashes/Fri, 28 Jun 2019 07:12:39 GMT