title: Javascript onclick: only works once
body: <p>Here is the method I call, where I delete the event by id:</p>
  
  <pre><code>function delete_event(id)
  {
      $.ajax({
          url: "/delete/"+id,
          type: "post",
          data: {  '_token': '{{csrf_token()}}' },
          success: function(data) {
              if (data.success == 1)
              {
                  $("#alert").addClass("alert alert-success");
                  $("#alert").innerText = "it worked";
                  $("#alert").remove();
                  $("alert").fadeOut(3000);
              }
              else
              {
                  $("#alert").addClass("alert alert-danger");
                  $("#alert").text("it didn't work");
                  $("#alert").delay(3000).fadeOut(1000);
              }
          },
          error: function(data)
          {
              console.log("neieieiin");
              console.log(data);
          },
          complete: function(){}
      })
  }
  </code></pre>
  
  <p>Here is the HTML-Code:</p>
  
  <pre><code>&lt;div id="alert"&gt;
  &lt;/div&gt;
  
  &lt;table class="table table-striped"&gt;
      &lt;tr&gt;
          &lt;th&gt;Event Name&lt;/th&gt;
          &lt;th&gt;Starting Date&lt;/th&gt;
          &lt;th&gt;Location&lt;/th&gt;
          &lt;th&gt;Actions&lt;/th&gt;
      &lt;/tr&gt;
  
      @foreach($events as $event)
          &lt;tr id="{{$event-&gt;event_id}}"&gt;
              &lt;td&gt;{{$event-&gt;event_name }}&lt;/td&gt;
              &lt;td&gt;{{$event-&gt;start_date}}&lt;/td&gt;
              &lt;td&gt;{{$event-&gt;street_address}}&lt;/td&gt;
              &lt;td&gt;
                  &lt;a&gt;
                      &lt;button onclick="delete_event({{$event-&gt;event_id}})" type="button" class="btn btn-default"&gt;
                      &lt;i class="fa fa-times" aria-hidden="true"&gt;&lt;/i&gt;
                      &lt;/button&gt;
                  &lt;/a&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
      @endforeach
  
  &lt;/table&gt;
  @endsection
  </code></pre>
  
  <p>When I click the delete button it only once shows it worked/it didn't work. If I click it a second time nothing happens any suggestions?</p>