Skip to content

Commit 00f28bb

Browse files
committed
removed data response from delete
1 parent e9c3d0b commit 00f28bb

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

03/rendering_content_at_the_clientside/protected/assets/todo.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,17 @@ var todo = {
4141
onDelete: function(e) {
4242
e.preventDefault();
4343

44+
var id = $(this).parents('.task').attr('data-id');
45+
4446
$.ajax({
4547
url: todo.options.taskEndpoint,
4648
type: 'delete',
4749
data: {
48-
id: $(this).parents('.task').attr('data-id')
50+
id: id
4951
},
5052
dataType: 'json',
51-
success: function(response) {
52-
$('.task[data-id='+response.data.id+']').remove();
53+
success: function() {
54+
$('.task[data-id='+id+']').remove();
5355
},
5456
error: todo.onFailure
5557
});

03/rendering_content_at_the_clientside/protected/controllers/TodoController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ private function handleDelete($id)
7878
{
7979
$task = $this->getTask($id);
8080
if($task->delete()) {
81-
$this->sendResponse($task->attributes);
81+
$this->sendResponse('OK');
8282
}
8383
else {
8484
$this->sendResponse(array(), 500, array('Unable to delete task.'));

0 commit comments

Comments
 (0)