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 code is not working in ASP.Net<blockquote><cite>himani895 says:</cite> <pre><code class="js spaces">&nbsp;</code><code class="js plain">data: questions,</code></pre> </blockquote> <p>&nbsp;There is problem in your code, in data you are passing wrong parameter,&nbsp; So please make sure you are passing correct parameter.</p> <p>Please refer below article link for your reference-</p> <h1 class="header"><a title="Make AJAX Call to ASP.Net Server Side Web service method using jQuery'a" href="https://www.aspsnippets.com/Articles/Make-AJAX-Call-to-ASP.Net-Server-Side-Web-service-method-using-jQuery.aspx">Make AJAX Call to ASP.Net Server Side Web service method using jQuery</a></h1>https://www.aspforums.net:443/Threads/626006/Solved-jQuery-AJAX-code-is-not-working-in-ASPNet/https://www.aspforums.net:443/Threads/626006/Solved-jQuery-AJAX-code-is-not-working-in-ASPNet/Thu, 11 Oct 2018 07:48:20 GMT[Solved] jQuery AJAX code is not working in ASP.Net<p>Hi <a class="username" rel="himani895">himani895</a>,</p> <p>Please check below modified code.</p> <p><span style="text-decoration: underline;"><strong>HTML</strong></span></p> <pre class="brush: html">&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;&gt; $(document).ready(function () { $(&#34;#ddl1&#34;).change(function () { var total = $(&#34;#ddl1&#34;).val(); var rawhtml = &#34;&#34;; var textarray = &#34;&#34;; for (var i = 1; i &lt;= total; i++) { rawhtml += &#34;&lt;textarea id=&#39;txtbox&#34; + i + &#34;&#39; class = &#39;txtoption&#39; wrap = &#39;hard&#39;/&gt;&lt;br/&gt;&#34;; } $(&#34;#alltext&#34;).html(rawhtml); }); $(&#34;#btnsave&#34;).click(function () { var textlen = $(&#34;.txtoption&#34;).length; alert(textlen); for (var i = 1; i &lt;= textlen; i++) { var questions = $(&#34;#txtbox&#34; + i).val(); alert(questions); $.ajax({ url: &#34;feedback_form.aspx.aspx/insertDynamicData&#34;, data: &#39;{questions:&#34;&#39; + questions + &#39;&#34;}&#39;, type: &#39;POST&#39;, contentType: &#34;application/json; charset=utf-8&#34;, dataType: &#34;json&#34;, success: function (data) { alert(&#34;page submitted successfully&#34;); }, error: function (err) { alert(err); } }); } }); }); &lt;/script&gt; &lt;div&gt; Number of questions: &lt;select id=&#34;ddl1&#34;&gt; &lt;option value=&#34;1&#34;&gt;1&lt;/option&gt; &lt;option value=&#34;2&#34;&gt;2&lt;/option&gt; &lt;option value=&#34;3&#34;&gt;3&lt;/option&gt; &lt;/select&gt; &lt;div id=&#34;alltext&#34;&gt; &lt;/div&gt; &lt;br /&gt; &lt;input type=&#34;button&#34; id=&#34;btnsave&#34; runat=&#34;server&#34; value=&#34;save&#34; /&gt; &lt;input type=&#34;button&#34; value=&#34;show data&#34; id=&#34;btnShowData&#34; /&gt; &lt;/div&gt;</pre> <p><span style="text-decoration: underline;"><strong>Namespaces</strong></span></p> <p><strong>C#</strong></p> <pre class="brush: csharp">using System.Web.Services; using System.Configuration; using System.Data.SqlClient; </pre> <p><span style="text-decoration: underline;"><strong>Code</strong></span></p> <p><strong>C#</strong></p> <pre class="brush: csharp">[WebMethod] public static string insertDynamicData(string questions) { string cmg = ConfigurationManager.ConnectionStrings["conCRM"].ConnectionString; using (SqlConnection cnn = new SqlConnection(cmg)) { cnn.Open(); string query = "insert into dbo.question(questions) values(@questions)"; SqlCommand cmd = new SqlCommand(query, cnn); cmd.ExecuteNonQuery(); cnn.Close(); } return "Submit"; }</pre>https://www.aspforums.net:443/Threads/626006/Solved-jQuery-AJAX-code-is-not-working-in-ASPNet/https://www.aspforums.net:443/Threads/626006/Solved-jQuery-AJAX-code-is-not-working-in-ASPNet/Thu, 11 Oct 2018 23:46:37 GMT