Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8192531
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T04:12:07+00:00 2026-06-07T04:12:07+00:00

i have a form with c#(.net4) code behind . in this form user fill

  • 0

i have a form with c#(.net4) code behind . in this form user fill his specification and submit.
i wanna use ajax or post method in jquery for prevention of blink.i write flowing code. “success” function execute but it does not work and any record insert in database;i execute executemember method separately.it works without problem but it does not work with jquery ajax.where is problem?

[WebMethod]
    public static string executeinsert(string name ,string family , string username,string password , string  email,string tel, string codemeli)
    {   string constring = "data source=.;database=site;integrated security=true;";

        SqlConnection con = new SqlConnection(constring);
        SqlCommand com = new SqlCommand("insertmember", con);
        com.CommandType = CommandType.StoredProcedure;
        com.Parameters.Add(new SqlParameter("@username", SqlDbType.NVarChar, 250));
        com.Parameters["@username"].Value = username;
        com.Parameters.Add(new SqlParameter("@name", SqlDbType.NVarChar, 150));
        com.Parameters["@name"].Value = name;
        com.Parameters.Add(new SqlParameter("@password", SqlDbType.NVarChar, 50));
        com.Parameters["@password"].Value = password;
        com.Parameters.Add(new SqlParameter("@family", SqlDbType.NVarChar, 250));
        com.Parameters["@family"].Value = family;
        com.Parameters.Add(new SqlParameter("@email", SqlDbType.NVarChar, 50));
        com.Parameters["@email"].Value = email;
        com.Parameters.Add(new SqlParameter("@codemeli", SqlDbType.NChar, 10));
        com.Parameters["@codemeli"].Value = codemeli;
        com.Parameters.Add(new SqlParameter("@tel", SqlDbType.NChar, 12));
        com.Parameters["@tel"].Value = tel;
        con.Open();
        com.ExecuteNonQuery();
        con.Close();
        return "success";
        }

and its my jquery code

 <script type="text/javascript">
    $(document).ready(
    function () {
        $("#Button1").click(
            function () {
                var username, family, name, email, tel, codemeli, password;
                username = $('#<%=TextBox1.ClientID%>').val();
                name = $('#<%=TextBox2.ClientID%>').val();
                family = $('#<%=TextBox3.ClientID%>').val();
                password = $('#<%=TextBox4.ClientID%>').val();
                email = $('#<%=TextBox5.ClientID%>').val();
                tel = $('#<%=TextBox6.ClientID%>').val();
                codemeli = $('#<%=TextBox7.ClientID%>').val();

                $.ajax(
                {
                    type: "POST",
                    url: "WebApplication20.aspx/executeinsert",
                    data: "{'username':'username','name':name,
                            'family':family,'password':password,
                            'email':email,'tel':tel,
                            'codemeli':codemeli}",
                    contentType: "application/json;charset=utf-8",
                    dataType: "json",
                    async: true,
                    cache: false,
                    success: function(msg) {
                        alert(msg);
                    },
                    error: function (x, e) {
                        alert("The call to the server side failed. " 
                              + x.responseText);
                    }
                }
            );
        }
     )
 })
</script>

thank

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T04:12:08+00:00Added an answer on June 7, 2026 at 4:12 am

    Check this out:

    $(document).ready(function () {
        $("#Button1").click(function () {
            var userData = new Object();
    
            userData.username = $('#<%=TextBox1.ClientID%>').val();
            userData.name = $('#<%=TextBox2.ClientID%>').val();
            userData.family = $('#<%=TextBox3.ClientID%>').val();
            userData.password = $('#<%=TextBox4.ClientID%>').val();
            userData.email = $('#<%=TextBox5.ClientID%>').val();
            userData.tel = $('#<%=TextBox6.ClientID%>').val();
            userData.codemeli = $('#<%=TextBox7.ClientID%>').val();
    
            $.ajax({
                type: "POST",
                url: "WebApplication20.aspx/executeinsert",
                data: userData,
                contentType: "application/json;charset=utf-8",
                dataType: "json",
                async: true,
                cache: false,
                success: function (msg) {
                    alert(msg);
                },
                error: function (x, e) {
                    alert("The call to the server side failed. " + x.responseText);
                }
            });
        });
    });
    

    P.S. Try to debug and put breakpoint in the webmethod if it calls at all.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have form in my page, I am using ajax.beginform(). Inside this form I
i have form with user data to input and javascript ajax to send information
I have the following code on my Home.aspx page: <form id=frmJump method=post action=Views/ViewsHome.aspx> <input
I have form where user submits field. Field can have letters, numbers, and punctuation.
I have form like this: <div class=satu> <input type='text' size='1' maxlength='1' name='score[1][]' id='score[1][]'> </div>
I have form like this : <div id='add_field' class='locbutton'><a href='#' title='Add'>Add</a></div> <div id='remove_field' class='locbutton2'><a
I have two strange problems when I use routing in a web form application.
ASP.NET 4.0 Need some help with this vexing HTTP POST problem - I have
I have a page with normal Ajax Update panel. There is a submit button
I use ASP .Net 4 and I have a project using the form web

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.