jQuery DataTables editing the row in jquery dataTable and save to the database












0















I am using jQuery dataTables, ajax, and web services to display my data from the SQL database. I am successful in doing this, however now I need a way to be able to update only one column of the record in the database from the datatable.



What I want: if I click on the edit button, the will be a modal pop and then I input a value in the pop, that value should be added to the already existing value in the database. This is because entries should accumulate on a daily interval when new entries are made. my issue is that I have managed to write the web method in the web service and it looks fine, but I can't update the field i want, please can you help as I don't have much knowledge with jQuery dataTables and ajax (how to get the id of the record I want to update and finally able to update in the client side using jQuery ajax)



This is what I have tried:



Clientside jQuery and ajax:



 $(document).ready(function () {
insertkpi();
submitinit();

displayKPI();
updateprogress(Id);
});


Displaying in the DataTable



 function displayKPI() {
$.ajax({
url: 'MyService.asmx/getKPI',
method: 'post',
dataType: 'json',
success: function (data) {
$('#datatable').DataTable({
data: data,
columns: [
{ 'data': 'Name' },
{
'data': '', 'render': function () {
return "<a class='btn btn-default btn-sm' data-target='#iniativemodal' data-toggle='modal'><i class='glyphicon glyphicon-pencil'>Initiative</i></a>";
}

},
{ 'data': 'Initiative' },
{
'data': 'perfomance',
'render': function (perfomance) {
return perfomance + "%";
}
},
{
'data': 'progress'
//'render': function (progress) {
// return "<a class='btn btn-default btn-sm' data-target='#progressmodal' data-toggle='modal'><i class='fa fa-pencil'>Progress</i></a>";
// }
},
{ 'data': 'BaseTarget' },
{
'data': 'streachTarget'

},
{ 'data': 'Period' },
{
'data': 'Id' ,
'render': function (Id, type, full, meta) {

return '<a href="#" onclick="updateprogress(' + Id + ')" ><i class="glyphicon glyphicon-pencil"></i></a>';
}
},
]
});
}

}
);
}


The function to update the database value taking the ID from the DataTable:



 function updateprogress(Id) {

// var url = "MyService.asmx/getProgress?Id=" + Id+"";
// var url = "MyService.asmx/updateprogres";
$("#progrdata").load("MyService.asmx/updateprogres?Id=" + Id + "", function () {
$("#progressmodal").modal("show");

$("#progrebtn").click(function () {

var progress = $('#pgtxt').val();
var cid = Id.val();
$.ajax({
type: "POST",
url: 'MyService.asmx/updateprogres',
contentType: "application/json;charset=utf-8",
datatype: "json",
data: '{Id: ' +Id + ', progress: "' + progress + '" }',
success: function () {

$('#progressmodal').modal('hide');
},
});
});
})
}


HTML markup:



 <div class="modal" id="progressmodal" data-keyboad="false" data-backdrop="static" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Input Progress</h4>
<button class="close" data-dismiss="modal">&times;</button>
</div>
<div class="modal-body" id="progrdata">

<div class="form-group">
<label id ="pnamelb">Cumulative Progress</label>
<label id="prglbl" />
</div>
<div class="form-group">
<label id ="pinelb">Enter progress</label>
<label id="finalpglbl"></label>
<input type="text" class="form-control" id="pgtxt" />
</div>
</div>
<div class="modal-footer">
<button class="btn-primary" id="progrebtn">Save</button>
<button class="btn-primary" data-dismiss="modal">Cancel</button>
</div>
</div>
</div>
</div>


My web method:



[WebMethod]
public void updateprogres(int Id,int progress)
{
string constring = System.Configuration.ConfigurationManager.ConnectionStrings["MyConnectionString"].ConnectionString;
using (SqlConnection conn = new SqlConnection(constring))
{

using (SqlCommand cmd = new SqlCommand("UPDATE KPIs SET progress=@progress WHERE [Id] =@Id",conn))
{
try
{
conn.Open();
cmd.Parameters.AddWithValue("@Id", Id);
cmd.Parameters.AddWithValue("@progress", progress);
cmd.ExecuteNonQuery();
}
catch (Exception)
{
}
finally
{
conn.Close();
}
}
}
}









share|improve this question

























  • Add an primary key id column in datatable and hide it from the front end.

    – Sumesh TG
    Nov 28 '18 at 13:26











  • but i think i added it look here, { 'data': 'Id' , 'render': function (Id, type, full, meta) { return '<a href="#" onclick="updateprogress(' + Id + ')" ><i class="glyphicon glyphicon-pencil"></i></a>'; }

    – Timothy
    Nov 28 '18 at 13:35













  • you like to update the whole table after update occurs? or only like to update the cell?

    – MonkeyDLuffy
    Nov 28 '18 at 13:45











  • HI @MonkeyDLuffy, yes i want to update only the cell

    – Timothy
    Nov 28 '18 at 13:53
















0















I am using jQuery dataTables, ajax, and web services to display my data from the SQL database. I am successful in doing this, however now I need a way to be able to update only one column of the record in the database from the datatable.



What I want: if I click on the edit button, the will be a modal pop and then I input a value in the pop, that value should be added to the already existing value in the database. This is because entries should accumulate on a daily interval when new entries are made. my issue is that I have managed to write the web method in the web service and it looks fine, but I can't update the field i want, please can you help as I don't have much knowledge with jQuery dataTables and ajax (how to get the id of the record I want to update and finally able to update in the client side using jQuery ajax)



This is what I have tried:



Clientside jQuery and ajax:



 $(document).ready(function () {
insertkpi();
submitinit();

displayKPI();
updateprogress(Id);
});


Displaying in the DataTable



 function displayKPI() {
$.ajax({
url: 'MyService.asmx/getKPI',
method: 'post',
dataType: 'json',
success: function (data) {
$('#datatable').DataTable({
data: data,
columns: [
{ 'data': 'Name' },
{
'data': '', 'render': function () {
return "<a class='btn btn-default btn-sm' data-target='#iniativemodal' data-toggle='modal'><i class='glyphicon glyphicon-pencil'>Initiative</i></a>";
}

},
{ 'data': 'Initiative' },
{
'data': 'perfomance',
'render': function (perfomance) {
return perfomance + "%";
}
},
{
'data': 'progress'
//'render': function (progress) {
// return "<a class='btn btn-default btn-sm' data-target='#progressmodal' data-toggle='modal'><i class='fa fa-pencil'>Progress</i></a>";
// }
},
{ 'data': 'BaseTarget' },
{
'data': 'streachTarget'

},
{ 'data': 'Period' },
{
'data': 'Id' ,
'render': function (Id, type, full, meta) {

return '<a href="#" onclick="updateprogress(' + Id + ')" ><i class="glyphicon glyphicon-pencil"></i></a>';
}
},
]
});
}

}
);
}


The function to update the database value taking the ID from the DataTable:



 function updateprogress(Id) {

// var url = "MyService.asmx/getProgress?Id=" + Id+"";
// var url = "MyService.asmx/updateprogres";
$("#progrdata").load("MyService.asmx/updateprogres?Id=" + Id + "", function () {
$("#progressmodal").modal("show");

$("#progrebtn").click(function () {

var progress = $('#pgtxt').val();
var cid = Id.val();
$.ajax({
type: "POST",
url: 'MyService.asmx/updateprogres',
contentType: "application/json;charset=utf-8",
datatype: "json",
data: '{Id: ' +Id + ', progress: "' + progress + '" }',
success: function () {

$('#progressmodal').modal('hide');
},
});
});
})
}


HTML markup:



 <div class="modal" id="progressmodal" data-keyboad="false" data-backdrop="static" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Input Progress</h4>
<button class="close" data-dismiss="modal">&times;</button>
</div>
<div class="modal-body" id="progrdata">

<div class="form-group">
<label id ="pnamelb">Cumulative Progress</label>
<label id="prglbl" />
</div>
<div class="form-group">
<label id ="pinelb">Enter progress</label>
<label id="finalpglbl"></label>
<input type="text" class="form-control" id="pgtxt" />
</div>
</div>
<div class="modal-footer">
<button class="btn-primary" id="progrebtn">Save</button>
<button class="btn-primary" data-dismiss="modal">Cancel</button>
</div>
</div>
</div>
</div>


My web method:



[WebMethod]
public void updateprogres(int Id,int progress)
{
string constring = System.Configuration.ConfigurationManager.ConnectionStrings["MyConnectionString"].ConnectionString;
using (SqlConnection conn = new SqlConnection(constring))
{

using (SqlCommand cmd = new SqlCommand("UPDATE KPIs SET progress=@progress WHERE [Id] =@Id",conn))
{
try
{
conn.Open();
cmd.Parameters.AddWithValue("@Id", Id);
cmd.Parameters.AddWithValue("@progress", progress);
cmd.ExecuteNonQuery();
}
catch (Exception)
{
}
finally
{
conn.Close();
}
}
}
}









share|improve this question

























  • Add an primary key id column in datatable and hide it from the front end.

    – Sumesh TG
    Nov 28 '18 at 13:26











  • but i think i added it look here, { 'data': 'Id' , 'render': function (Id, type, full, meta) { return '<a href="#" onclick="updateprogress(' + Id + ')" ><i class="glyphicon glyphicon-pencil"></i></a>'; }

    – Timothy
    Nov 28 '18 at 13:35













  • you like to update the whole table after update occurs? or only like to update the cell?

    – MonkeyDLuffy
    Nov 28 '18 at 13:45











  • HI @MonkeyDLuffy, yes i want to update only the cell

    – Timothy
    Nov 28 '18 at 13:53














0












0








0








I am using jQuery dataTables, ajax, and web services to display my data from the SQL database. I am successful in doing this, however now I need a way to be able to update only one column of the record in the database from the datatable.



What I want: if I click on the edit button, the will be a modal pop and then I input a value in the pop, that value should be added to the already existing value in the database. This is because entries should accumulate on a daily interval when new entries are made. my issue is that I have managed to write the web method in the web service and it looks fine, but I can't update the field i want, please can you help as I don't have much knowledge with jQuery dataTables and ajax (how to get the id of the record I want to update and finally able to update in the client side using jQuery ajax)



This is what I have tried:



Clientside jQuery and ajax:



 $(document).ready(function () {
insertkpi();
submitinit();

displayKPI();
updateprogress(Id);
});


Displaying in the DataTable



 function displayKPI() {
$.ajax({
url: 'MyService.asmx/getKPI',
method: 'post',
dataType: 'json',
success: function (data) {
$('#datatable').DataTable({
data: data,
columns: [
{ 'data': 'Name' },
{
'data': '', 'render': function () {
return "<a class='btn btn-default btn-sm' data-target='#iniativemodal' data-toggle='modal'><i class='glyphicon glyphicon-pencil'>Initiative</i></a>";
}

},
{ 'data': 'Initiative' },
{
'data': 'perfomance',
'render': function (perfomance) {
return perfomance + "%";
}
},
{
'data': 'progress'
//'render': function (progress) {
// return "<a class='btn btn-default btn-sm' data-target='#progressmodal' data-toggle='modal'><i class='fa fa-pencil'>Progress</i></a>";
// }
},
{ 'data': 'BaseTarget' },
{
'data': 'streachTarget'

},
{ 'data': 'Period' },
{
'data': 'Id' ,
'render': function (Id, type, full, meta) {

return '<a href="#" onclick="updateprogress(' + Id + ')" ><i class="glyphicon glyphicon-pencil"></i></a>';
}
},
]
});
}

}
);
}


The function to update the database value taking the ID from the DataTable:



 function updateprogress(Id) {

// var url = "MyService.asmx/getProgress?Id=" + Id+"";
// var url = "MyService.asmx/updateprogres";
$("#progrdata").load("MyService.asmx/updateprogres?Id=" + Id + "", function () {
$("#progressmodal").modal("show");

$("#progrebtn").click(function () {

var progress = $('#pgtxt').val();
var cid = Id.val();
$.ajax({
type: "POST",
url: 'MyService.asmx/updateprogres',
contentType: "application/json;charset=utf-8",
datatype: "json",
data: '{Id: ' +Id + ', progress: "' + progress + '" }',
success: function () {

$('#progressmodal').modal('hide');
},
});
});
})
}


HTML markup:



 <div class="modal" id="progressmodal" data-keyboad="false" data-backdrop="static" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Input Progress</h4>
<button class="close" data-dismiss="modal">&times;</button>
</div>
<div class="modal-body" id="progrdata">

<div class="form-group">
<label id ="pnamelb">Cumulative Progress</label>
<label id="prglbl" />
</div>
<div class="form-group">
<label id ="pinelb">Enter progress</label>
<label id="finalpglbl"></label>
<input type="text" class="form-control" id="pgtxt" />
</div>
</div>
<div class="modal-footer">
<button class="btn-primary" id="progrebtn">Save</button>
<button class="btn-primary" data-dismiss="modal">Cancel</button>
</div>
</div>
</div>
</div>


My web method:



[WebMethod]
public void updateprogres(int Id,int progress)
{
string constring = System.Configuration.ConfigurationManager.ConnectionStrings["MyConnectionString"].ConnectionString;
using (SqlConnection conn = new SqlConnection(constring))
{

using (SqlCommand cmd = new SqlCommand("UPDATE KPIs SET progress=@progress WHERE [Id] =@Id",conn))
{
try
{
conn.Open();
cmd.Parameters.AddWithValue("@Id", Id);
cmd.Parameters.AddWithValue("@progress", progress);
cmd.ExecuteNonQuery();
}
catch (Exception)
{
}
finally
{
conn.Close();
}
}
}
}









share|improve this question
















I am using jQuery dataTables, ajax, and web services to display my data from the SQL database. I am successful in doing this, however now I need a way to be able to update only one column of the record in the database from the datatable.



What I want: if I click on the edit button, the will be a modal pop and then I input a value in the pop, that value should be added to the already existing value in the database. This is because entries should accumulate on a daily interval when new entries are made. my issue is that I have managed to write the web method in the web service and it looks fine, but I can't update the field i want, please can you help as I don't have much knowledge with jQuery dataTables and ajax (how to get the id of the record I want to update and finally able to update in the client side using jQuery ajax)



This is what I have tried:



Clientside jQuery and ajax:



 $(document).ready(function () {
insertkpi();
submitinit();

displayKPI();
updateprogress(Id);
});


Displaying in the DataTable



 function displayKPI() {
$.ajax({
url: 'MyService.asmx/getKPI',
method: 'post',
dataType: 'json',
success: function (data) {
$('#datatable').DataTable({
data: data,
columns: [
{ 'data': 'Name' },
{
'data': '', 'render': function () {
return "<a class='btn btn-default btn-sm' data-target='#iniativemodal' data-toggle='modal'><i class='glyphicon glyphicon-pencil'>Initiative</i></a>";
}

},
{ 'data': 'Initiative' },
{
'data': 'perfomance',
'render': function (perfomance) {
return perfomance + "%";
}
},
{
'data': 'progress'
//'render': function (progress) {
// return "<a class='btn btn-default btn-sm' data-target='#progressmodal' data-toggle='modal'><i class='fa fa-pencil'>Progress</i></a>";
// }
},
{ 'data': 'BaseTarget' },
{
'data': 'streachTarget'

},
{ 'data': 'Period' },
{
'data': 'Id' ,
'render': function (Id, type, full, meta) {

return '<a href="#" onclick="updateprogress(' + Id + ')" ><i class="glyphicon glyphicon-pencil"></i></a>';
}
},
]
});
}

}
);
}


The function to update the database value taking the ID from the DataTable:



 function updateprogress(Id) {

// var url = "MyService.asmx/getProgress?Id=" + Id+"";
// var url = "MyService.asmx/updateprogres";
$("#progrdata").load("MyService.asmx/updateprogres?Id=" + Id + "", function () {
$("#progressmodal").modal("show");

$("#progrebtn").click(function () {

var progress = $('#pgtxt').val();
var cid = Id.val();
$.ajax({
type: "POST",
url: 'MyService.asmx/updateprogres',
contentType: "application/json;charset=utf-8",
datatype: "json",
data: '{Id: ' +Id + ', progress: "' + progress + '" }',
success: function () {

$('#progressmodal').modal('hide');
},
});
});
})
}


HTML markup:



 <div class="modal" id="progressmodal" data-keyboad="false" data-backdrop="static" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Input Progress</h4>
<button class="close" data-dismiss="modal">&times;</button>
</div>
<div class="modal-body" id="progrdata">

<div class="form-group">
<label id ="pnamelb">Cumulative Progress</label>
<label id="prglbl" />
</div>
<div class="form-group">
<label id ="pinelb">Enter progress</label>
<label id="finalpglbl"></label>
<input type="text" class="form-control" id="pgtxt" />
</div>
</div>
<div class="modal-footer">
<button class="btn-primary" id="progrebtn">Save</button>
<button class="btn-primary" data-dismiss="modal">Cancel</button>
</div>
</div>
</div>
</div>


My web method:



[WebMethod]
public void updateprogres(int Id,int progress)
{
string constring = System.Configuration.ConfigurationManager.ConnectionStrings["MyConnectionString"].ConnectionString;
using (SqlConnection conn = new SqlConnection(constring))
{

using (SqlCommand cmd = new SqlCommand("UPDATE KPIs SET progress=@progress WHERE [Id] =@Id",conn))
{
try
{
conn.Open();
cmd.Parameters.AddWithValue("@Id", Id);
cmd.Parameters.AddWithValue("@progress", progress);
cmd.ExecuteNonQuery();
}
catch (Exception)
{
}
finally
{
conn.Close();
}
}
}
}






jquery asp.net ajax datatables asp.net-ajax






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 28 '18 at 20:50









marc_s

582k13011231269




582k13011231269










asked Nov 28 '18 at 13:24









TimothyTimothy

14




14













  • Add an primary key id column in datatable and hide it from the front end.

    – Sumesh TG
    Nov 28 '18 at 13:26











  • but i think i added it look here, { 'data': 'Id' , 'render': function (Id, type, full, meta) { return '<a href="#" onclick="updateprogress(' + Id + ')" ><i class="glyphicon glyphicon-pencil"></i></a>'; }

    – Timothy
    Nov 28 '18 at 13:35













  • you like to update the whole table after update occurs? or only like to update the cell?

    – MonkeyDLuffy
    Nov 28 '18 at 13:45











  • HI @MonkeyDLuffy, yes i want to update only the cell

    – Timothy
    Nov 28 '18 at 13:53



















  • Add an primary key id column in datatable and hide it from the front end.

    – Sumesh TG
    Nov 28 '18 at 13:26











  • but i think i added it look here, { 'data': 'Id' , 'render': function (Id, type, full, meta) { return '<a href="#" onclick="updateprogress(' + Id + ')" ><i class="glyphicon glyphicon-pencil"></i></a>'; }

    – Timothy
    Nov 28 '18 at 13:35













  • you like to update the whole table after update occurs? or only like to update the cell?

    – MonkeyDLuffy
    Nov 28 '18 at 13:45











  • HI @MonkeyDLuffy, yes i want to update only the cell

    – Timothy
    Nov 28 '18 at 13:53

















Add an primary key id column in datatable and hide it from the front end.

– Sumesh TG
Nov 28 '18 at 13:26





Add an primary key id column in datatable and hide it from the front end.

– Sumesh TG
Nov 28 '18 at 13:26













but i think i added it look here, { 'data': 'Id' , 'render': function (Id, type, full, meta) { return '<a href="#" onclick="updateprogress(' + Id + ')" ><i class="glyphicon glyphicon-pencil"></i></a>'; }

– Timothy
Nov 28 '18 at 13:35







but i think i added it look here, { 'data': 'Id' , 'render': function (Id, type, full, meta) { return '<a href="#" onclick="updateprogress(' + Id + ')" ><i class="glyphicon glyphicon-pencil"></i></a>'; }

– Timothy
Nov 28 '18 at 13:35















you like to update the whole table after update occurs? or only like to update the cell?

– MonkeyDLuffy
Nov 28 '18 at 13:45





you like to update the whole table after update occurs? or only like to update the cell?

– MonkeyDLuffy
Nov 28 '18 at 13:45













HI @MonkeyDLuffy, yes i want to update only the cell

– Timothy
Nov 28 '18 at 13:53





HI @MonkeyDLuffy, yes i want to update only the cell

– Timothy
Nov 28 '18 at 13:53












2 Answers
2






active

oldest

votes


















0














In success method of your ajax post. find the index of the td you like to update and set the progress to it. like ;



   $("#progrebtn").closest("tr").find("td:eq(4)").text(progress);


https://codepen.io/anon/pen/oQaWeg






share|improve this answer
























  • i have tried this just now but without success, i tried to debug and i saw that my web services is working just fine, but the issue is with the Url,

    – Timothy
    Nov 28 '18 at 14:44











  • i have seen that im getting this error when i try to pass my parameters through the url in my webservices, how can go about it. Request format is unrecognized for URL unexpectedly ending in '/updateprogres'.; this the url im using for testing the webservice localhost:49589/MyService.asmx/…

    – Timothy
    Nov 29 '18 at 10:27





















0














So regarding my issue i have managed to solve it now, my error was that i was missing another parameter, that is the one i wanted to update. check the JS function now



 function updateprogress(Id) {

// var url = "MyService.asmx/getProgress?Id=" + Id+"";

var urll = "MyService.asmx/updateprogres?Id=" + Id + "&progress=" + $('#pgtxt').val() + "";

$("#progrdata").load(urll, function () {
$("#progressmodal").modal("show");

$("#progrebtn").click(function () {

var progress = $('#pgtxt').val();

$.ajax({
type: "POST",
url: urll,
contentType: "application/json;charset=utf-8",
datatype: "json",
data: '{Id: ' +Id + ', progress: "' + progress + '" }',
success: function () {
$("#progrebtn").closest("tr").find("td:eq(4)").text(400);
$('#progressmodal').modal('hide');
},

});


});
})




}





share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53520479%2fjquery-datatables-editing-the-row-in-jquery-datatable-and-save-to-the-database%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    In success method of your ajax post. find the index of the td you like to update and set the progress to it. like ;



       $("#progrebtn").closest("tr").find("td:eq(4)").text(progress);


    https://codepen.io/anon/pen/oQaWeg






    share|improve this answer
























    • i have tried this just now but without success, i tried to debug and i saw that my web services is working just fine, but the issue is with the Url,

      – Timothy
      Nov 28 '18 at 14:44











    • i have seen that im getting this error when i try to pass my parameters through the url in my webservices, how can go about it. Request format is unrecognized for URL unexpectedly ending in '/updateprogres'.; this the url im using for testing the webservice localhost:49589/MyService.asmx/…

      – Timothy
      Nov 29 '18 at 10:27


















    0














    In success method of your ajax post. find the index of the td you like to update and set the progress to it. like ;



       $("#progrebtn").closest("tr").find("td:eq(4)").text(progress);


    https://codepen.io/anon/pen/oQaWeg






    share|improve this answer
























    • i have tried this just now but without success, i tried to debug and i saw that my web services is working just fine, but the issue is with the Url,

      – Timothy
      Nov 28 '18 at 14:44











    • i have seen that im getting this error when i try to pass my parameters through the url in my webservices, how can go about it. Request format is unrecognized for URL unexpectedly ending in '/updateprogres'.; this the url im using for testing the webservice localhost:49589/MyService.asmx/…

      – Timothy
      Nov 29 '18 at 10:27
















    0












    0








    0







    In success method of your ajax post. find the index of the td you like to update and set the progress to it. like ;



       $("#progrebtn").closest("tr").find("td:eq(4)").text(progress);


    https://codepen.io/anon/pen/oQaWeg






    share|improve this answer













    In success method of your ajax post. find the index of the td you like to update and set the progress to it. like ;



       $("#progrebtn").closest("tr").find("td:eq(4)").text(progress);


    https://codepen.io/anon/pen/oQaWeg







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Nov 28 '18 at 14:19









    MonkeyDLuffyMonkeyDLuffy

    7410




    7410













    • i have tried this just now but without success, i tried to debug and i saw that my web services is working just fine, but the issue is with the Url,

      – Timothy
      Nov 28 '18 at 14:44











    • i have seen that im getting this error when i try to pass my parameters through the url in my webservices, how can go about it. Request format is unrecognized for URL unexpectedly ending in '/updateprogres'.; this the url im using for testing the webservice localhost:49589/MyService.asmx/…

      – Timothy
      Nov 29 '18 at 10:27





















    • i have tried this just now but without success, i tried to debug and i saw that my web services is working just fine, but the issue is with the Url,

      – Timothy
      Nov 28 '18 at 14:44











    • i have seen that im getting this error when i try to pass my parameters through the url in my webservices, how can go about it. Request format is unrecognized for URL unexpectedly ending in '/updateprogres'.; this the url im using for testing the webservice localhost:49589/MyService.asmx/…

      – Timothy
      Nov 29 '18 at 10:27



















    i have tried this just now but without success, i tried to debug and i saw that my web services is working just fine, but the issue is with the Url,

    – Timothy
    Nov 28 '18 at 14:44





    i have tried this just now but without success, i tried to debug and i saw that my web services is working just fine, but the issue is with the Url,

    – Timothy
    Nov 28 '18 at 14:44













    i have seen that im getting this error when i try to pass my parameters through the url in my webservices, how can go about it. Request format is unrecognized for URL unexpectedly ending in '/updateprogres'.; this the url im using for testing the webservice localhost:49589/MyService.asmx/…

    – Timothy
    Nov 29 '18 at 10:27







    i have seen that im getting this error when i try to pass my parameters through the url in my webservices, how can go about it. Request format is unrecognized for URL unexpectedly ending in '/updateprogres'.; this the url im using for testing the webservice localhost:49589/MyService.asmx/…

    – Timothy
    Nov 29 '18 at 10:27















    0














    So regarding my issue i have managed to solve it now, my error was that i was missing another parameter, that is the one i wanted to update. check the JS function now



     function updateprogress(Id) {

    // var url = "MyService.asmx/getProgress?Id=" + Id+"";

    var urll = "MyService.asmx/updateprogres?Id=" + Id + "&progress=" + $('#pgtxt').val() + "";

    $("#progrdata").load(urll, function () {
    $("#progressmodal").modal("show");

    $("#progrebtn").click(function () {

    var progress = $('#pgtxt').val();

    $.ajax({
    type: "POST",
    url: urll,
    contentType: "application/json;charset=utf-8",
    datatype: "json",
    data: '{Id: ' +Id + ', progress: "' + progress + '" }',
    success: function () {
    $("#progrebtn").closest("tr").find("td:eq(4)").text(400);
    $('#progressmodal').modal('hide');
    },

    });


    });
    })




    }





    share|improve this answer




























      0














      So regarding my issue i have managed to solve it now, my error was that i was missing another parameter, that is the one i wanted to update. check the JS function now



       function updateprogress(Id) {

      // var url = "MyService.asmx/getProgress?Id=" + Id+"";

      var urll = "MyService.asmx/updateprogres?Id=" + Id + "&progress=" + $('#pgtxt').val() + "";

      $("#progrdata").load(urll, function () {
      $("#progressmodal").modal("show");

      $("#progrebtn").click(function () {

      var progress = $('#pgtxt').val();

      $.ajax({
      type: "POST",
      url: urll,
      contentType: "application/json;charset=utf-8",
      datatype: "json",
      data: '{Id: ' +Id + ', progress: "' + progress + '" }',
      success: function () {
      $("#progrebtn").closest("tr").find("td:eq(4)").text(400);
      $('#progressmodal').modal('hide');
      },

      });


      });
      })




      }





      share|improve this answer


























        0












        0








        0







        So regarding my issue i have managed to solve it now, my error was that i was missing another parameter, that is the one i wanted to update. check the JS function now



         function updateprogress(Id) {

        // var url = "MyService.asmx/getProgress?Id=" + Id+"";

        var urll = "MyService.asmx/updateprogres?Id=" + Id + "&progress=" + $('#pgtxt').val() + "";

        $("#progrdata").load(urll, function () {
        $("#progressmodal").modal("show");

        $("#progrebtn").click(function () {

        var progress = $('#pgtxt').val();

        $.ajax({
        type: "POST",
        url: urll,
        contentType: "application/json;charset=utf-8",
        datatype: "json",
        data: '{Id: ' +Id + ', progress: "' + progress + '" }',
        success: function () {
        $("#progrebtn").closest("tr").find("td:eq(4)").text(400);
        $('#progressmodal').modal('hide');
        },

        });


        });
        })




        }





        share|improve this answer













        So regarding my issue i have managed to solve it now, my error was that i was missing another parameter, that is the one i wanted to update. check the JS function now



         function updateprogress(Id) {

        // var url = "MyService.asmx/getProgress?Id=" + Id+"";

        var urll = "MyService.asmx/updateprogres?Id=" + Id + "&progress=" + $('#pgtxt').val() + "";

        $("#progrdata").load(urll, function () {
        $("#progressmodal").modal("show");

        $("#progrebtn").click(function () {

        var progress = $('#pgtxt').val();

        $.ajax({
        type: "POST",
        url: urll,
        contentType: "application/json;charset=utf-8",
        datatype: "json",
        data: '{Id: ' +Id + ', progress: "' + progress + '" }',
        success: function () {
        $("#progrebtn").closest("tr").find("td:eq(4)").text(400);
        $('#progressmodal').modal('hide');
        },

        });


        });
        })




        }






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 29 '18 at 12:22









        TimothyTimothy

        14




        14






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53520479%2fjquery-datatables-editing-the-row-in-jquery-datatable-and-save-to-the-database%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

            Calculate evaluation metrics using cross_val_predict sklearn

            Insert data from modal to MySQL (multiple modal on website)