Click here to Skip to main content
15,880,392 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
C#
destroy: function (options) {

                               debugger;
                               var x = JSON.parse(kendo.stringify(options));
                               alert(x);
                               var data = JSON.parse(kendo.stringify(x.data));
                               alert(data);
                              var models = kendo.stringify(data);
                               models = models.replace("[", "");
                               models = models.replace("]", "");
                               alert(models);
                               var parsedData = JSON.parse(models);
                               alert(parsedData);
                               $.ajax({
                                   type: "POST",

                                   url: url2,
                                   contentType: "application/json; charset=utf-8",
                                   data: JSON.stringify({ id: parsedData.id }),

                                   dataType: "json",
                                   success: function (result) {
                                       if (result.d !== "success") {
                                           alert(result.d);
                                       }
                                       dataSource1.read();

                                   },
                                   error: function (result) {
                                       alert(result.Id);

                                   }
                               });
                           },
Posted
Updated 31-May-14 19:08pm
v3
Comments
DaveAuld 1-Jun-14 1:23am    
Does moving the JSON.STringify outside the ajax call and simply passing in a variable change the outcome?
Member 9965416 1-Jun-14 1:59am    
am getting the data which i want to delete in parsedData variable so in ajax call am asking id from total string will it wont work?
DaveAuld 1-Jun-14 2:12am    
Yes I see that, but start by testing with a known input, to prove the AJAX call works. e.g. simply pass in {id: '1'} or something like that and see what happens. Then passing in a variable containing that same test, then move the JSON.Stringify to outside the ajax call and only pass in the result of that code.
Member 9965416 1-Jun-14 2:29am    
giving static id is working but i lost u at this statement please bare with me and can u tell what that mean
"Then passing in a variable containing that same test, then move the JSON.Stringify to outside the ajax call and only pass in the result of that code."
DaveAuld 1-Jun-14 3:09am    
Outside ajax call do;
var theData = JSON.stringify({ id: parsedData.id })

inside the ajax call do;
data: theData,

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900