added delete function on store item
This commit is contained in:
@@ -1582,6 +1582,43 @@
|
||||
readURL(this, $id);
|
||||
});
|
||||
|
||||
$("#btn_delete_store_id").click(function() {
|
||||
var id = $(this).data('id');
|
||||
|
||||
var result = confirm("Are you want to delete?");
|
||||
if (result) {
|
||||
//Logic to delete the item
|
||||
$.ajax({
|
||||
type : 'POST',
|
||||
url : "{{ url('user/store-items/delete') }}",
|
||||
data : {
|
||||
id: id
|
||||
},
|
||||
beforeSend:function(xhr){
|
||||
var token = $('meta[name="csrf_token"]').attr('content');
|
||||
|
||||
if (token) {
|
||||
return xhr.setRequestHeader('X-CSRF-TOKEN', token);
|
||||
}
|
||||
xhr.setRequestHeader( 'X-Requested-With', 'XMLHttpRequest');
|
||||
},
|
||||
success : function(response){
|
||||
// console.log(response);
|
||||
if(response.success){
|
||||
alert(response.message);
|
||||
window.location = "{{ url('user/store-items') }}";
|
||||
}else{
|
||||
alert("Something went wrong. Please try again!");
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
}); //end document ready
|
||||
|
||||
// function
|
||||
|
||||
Reference in New Issue
Block a user