JavaScript

Friday 27 March 2015

Post List of object using ajax in server side



  This is simple step how to send data client side to server side using javascript and jquery
/// arry your object u can store value of json type
  var array = [];
        function SendData() {
            if (array.length > 0) {
                var json_Parse = JSON.stringify(array);
             
                console.log(json_Parse);
                $.ajax({
                    type: "post",
                    url: "LargeDataPageLoad.aspx/GetString",
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    data: '{ "obj":' + json_Parse + ' }',
                    success: function (response) {
                        response ? alert("It worked!") : alert("It didn't work.");
                        onCustomerClick();
                    },
                    error: function (xhr, status, error) {
                        alert(error);
                    }
                });
           
            }
       
         }

No comments:

Post a Comment