Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

jquery save method

SqlCommand cmd = new SqlCommand("insert jquerydata values('" + username + "','" + password + "'", con);
Comment

jquery save method

 [WebMethod]
    public static string InsertMethod(string username, string password)
    {
        SqlConnection con = new SqlConnection();
        con.ConnectionString = ConfigurationManager.ConnectionStrings["con"].ConnectionString;
        con.Open();
        SqlCommand cmd = new SqlCommand("insert jquerydata values('" + username + "','" + password + "'", con);
        cmd.CommandType = CommandType.Text;
        cmd.ExecuteNonQuery();
        cmd.Dispose();
        con.Close();
        return "true";

    }
Comment

jquery save method

<script type="text/javascript">
        $(document).ready(function () {
            $("#Button1").click(function () {
                $.ajax({
                    type: 'POST',
                    contentType: "application/json;charset=utf-8",
                    url: 'Default2.aspx/InsertMethod',
                    data: "{'username':'" + document.getElementById('txtusername').value + "','password':'" + document.getElementById("txtpassword").value + "'}",
                    async: false,
                    success: function (response) {
                        $('#txtusername').val('');
                        $('#txtpassword').val('');
                        alert("record has been saved in database");

                    },
                    error: function () {
                    console.log('there is some error');
                    }

                });

            });

        });
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript sorting an array 
Javascript :: display unique id number in angular 
Javascript :: create window electron 
Javascript :: add property to object javascript 
Javascript :: react hooks update parent state from child 
Javascript :: Discord.client on 
Javascript :: how to uninstall nodejs web server 
Javascript :: react native share link 
Javascript :: how to use cros 
Javascript :: how to decode jwt token client side 
Javascript :: js extract properties from object 
Javascript :: use two div id in jquery 
Javascript :: form handling in react 
Javascript :: paper in material ui 
Javascript :: html form structure 
Javascript :: angular2-tree-diagram 
Javascript :: jquery get search parameter 
Javascript :: mongoose pagination 
Javascript :: how to get current time using moment 
Javascript :: use excel in js 
Javascript :: javascript reduce method stack overflow 
Javascript :: react table with styles 
Javascript :: js on highlight 
Javascript :: js callback hell 
Javascript :: array within array javascript 
Javascript :: findindex method javascript 
Javascript :: shopify template routing map 
Javascript :: js for await 
Javascript :: review rating design 
Javascript :: nodejs: router by use express and path package 
ADD CONTENT
Topic
Content
Source link
Name
1+2 =