From dc0545b113aa9126f9f5c7a008fa7d5dce4cc7d8 Mon Sep 17 00:00:00 2001 From: Supan Adit Pratama Date: Sun, 28 Jun 2020 12:29:47 +0700 Subject: [PATCH] Enhance search todo --- resources/views/home.blade.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/resources/views/home.blade.php b/resources/views/home.blade.php index 6dda00e..1441103 100755 --- a/resources/views/home.blade.php +++ b/resources/views/home.blade.php @@ -263,13 +263,24 @@ }, contentType: "application/json", async: true, + beforeSend: function () { + $("#todo-list").html("
\n" + + " \n" + + "
"); + }, success: function (result) { if (result.length !== 0) { $("#todo-list").html(result.map(m => todoComponent(m))); } else { - $("#todo-list").html("
\n" + - "

 Not found or empty

\n" + - "
"); + if ($("#search-todo").val() != null && $("#search-todo").val() != "") { + $("#todo-list").html("
\n" + + "

 Not found

\n" + + "
"); + } else { + $("#todo-list").html("
\n" + + "

 Empty

\n" + + "
"); + } } }, error: function (result) {