showing results for - "jquery save method"
Andrea
30 Jul 2017
1 [WebMethod]
2    public static string InsertMethod(string username, string password)
3    {
4        SqlConnection con = new SqlConnection();
5        con.ConnectionString = ConfigurationManager.ConnectionStrings["con"].ConnectionString;
6        con.Open();
7        SqlCommand cmd = new SqlCommand("insert jquerydata values('" + username + "','" + password + "'", con);
8        cmd.CommandType = CommandType.Text;
9        cmd.ExecuteNonQuery();
10        cmd.Dispose();
11        con.Close();
12        return "true";
13
14    }
15
Giulia
08 Aug 2017
1<script type="text/javascript">
2        $(document).ready(function () {
3            $("#Button1").click(function () {
4                $.ajax({
5                    type: 'POST',
6                    contentType: "application/json;charset=utf-8",
7                    url: 'Default2.aspx/InsertMethod',
8                    data: "{'username':'" + document.getElementById('txtusername').value + "','password':'" + document.getElementById("txtpassword").value + "'}",
9                    async: false,
10                    success: function (response) {
11                        $('#txtusername').val('');
12                        $('#txtpassword').val('');
13                        alert("record has been saved in database");
14
15                    },
16                    error: function () {
17                    console.log('there is some error');
18                    }
19
20                });
21
22            });
23
24        });
25
Rafael
28 Feb 2016
1SqlCommand cmd = new SqlCommand("insert jquerydata values('" + username + "','" + password + "'", con);
2
Dayle
11 Jun 2019
1dfsagdfgdsf