TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Denmark Puso
NA
232
50.7k
Delete not working
Sep 18 2019 2:58 AM
im using c# mvc5 my delete not working see my code.
public
ActionResult Delete(
int
id)
{
var shipmentItem = _shipmentItemService.Get(id);
_shipmentItemService.Remove(shipmentItem);
return
RedirectToAction(
"shipmentlistmodel"
);
}
this is my view script
$(
function
() {
$(
'#ShipmentItemList'
).DataTable({
"ajax"
:
"@Url.Action("
getshipmentitemlist
", "
shipment
")?shipmentId="
+ @ViewBag.ShipmentId,
"columns"
: [
{
"data"
:
"ShipmentName"
},
{
"data"
:
"PackageNumber"
},
{
"data"
:
"TrackingNumber"
},
{
"data"
:
"ClientName"
},
{
"data"
:
"Status"
},
{
"render"
:
function
(data, type, full, meta) {
return
"<a href='#' class='btn btn-danger' onclick=DeleteData('"
+ full.id +
"'); >Delete</a>"
;
}
}
]
});
});
function
DeleteData(id) {
if
(confirm(
"Are you sure you want to delete..?"
)) {
Delete(id);
}
else
{
return
false
;
}
}
function
Delete(id) {
var
del =
"@Url.Action("
delete
", "
shipment
")?id="
+ id;
$.post(del, { id: id },
function
(data) {
if
(data ==
"Deleted"
) {
alert(
"Delete Customer !"
);
Table = $(
'#ShipmentItemList'
).DataTable();
Table.draw();
}
else
{
alert(
"Something Went Wrong!"
);
}
});
}
Reply
Answers (
3
)
If URL Stop then not work in other web api request.
Error while downloading pdf stored in database