javascript - Java Script / jQuery - How to redirect to another page -
i have mvc 5/c# application. have button on form allows user delete record db. when clicked button calls js function below. html allows user delete current row is:
<a class="btn btn-default" href="javascript:deletelocation(@model.rowid);">delete</a>
the js function looks follows:
function deletelocation(rowid) { var url = "/userlocation/delete"; var redirecturl = "/userlocation/index" $.get(url, { rowid: rowid }, function () { $.get(redirecturl); }); }
my c# delete method looks follows:
[authorize] public void delete(int rowid) { userlocationdata userlocationdata = new userlocationdata(); userlocationdata.delete(rowid); }
half of working perfectly. c# method getting called when user clicks button. however, after delete, page want redirect isn't getting displayed. tried putting redirecttoaction in c# method didn't work either. don't have large amount of experience js or jquery it's quite possible js wrong. or there better way this.
window.location should used send user page.
window.location.replace("http://yourwebsite.com");
Comments
Post a Comment