Note that there are some explanatory texts on larger screens.

plurals
  1. POredirect after alert message not working
    primarykey
    data
    text
    <p>this is a snippet of a js file></p> <pre><code>$('#btnYes').on('click', (function() { var id = $('#myModal').data('id'); var usertype = $('#myModal').data('usert'); $.ajax({ url: '{site_url()}admin/deleteUserFromList', type: 'POST', data: {id: id, userT: usertype}, success: function(html){ $('[data-id='+id+']').parents('tr').remove(); $('#myModal').modal('hide'); alert('usuario borrado'); window.location.reload(); } }); return false; })); </code></pre> <p>as you can see there is an alert message after deleting a user from a list.</p> <p>I want to refresh the page after ok on alert message is pressed so i added the line></p> <pre><code>window.location.reload(); </code></pre> <p>but it's not working, why is this? how can i fix it?</p> <p>I've been trying to use alternative to this like</p> <pre><code>location.href = '....'; window.location = '/some/url'; </code></pre> <p>but nothing seems to work!</p> <p>this is in my admin.php, the code for deleting user from the database:</p> <pre><code>public function deleteUserFromList(){ if ((isset($_POST['id']) &amp;&amp; (isset($_POST['userT'])))){ $rowId = $_POST['id']; $userType = $_POST['userT']; $result = array(); if($userType == 'front'){ $front = UserManager::getInstance()-&gt;getUser($rowId); UserManager::getInstance()-&gt;deleteItem($front); }else{ $back = UserBackManager::getInstance()-&gt;getUser($rowId); UserBackManager::getInstance()-&gt;deleteItem($back); } $result["message"] = "Usuario eliminado"; echo json_encode($result); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload