Aleksandar Djordjević Aleksandar Djordjević - 8 months ago 30
HTML Question

Javascript alert for deleting mysql data opens in new tab

I need to add JS alert for deleting certain records from mysql. Simple on... Sure you want to delete? Yes - leads to page to delete, No - does nothing. Problem is whenever i click on Yes it opens a new tab which i don't need (want all in current tab). Any solutions?


function confirmDelete(url) {
var aa =;
if (confirm("Sure to delete: "+ aa +"?")) {'/www/site/m_delete.php?id=' + aa +'');
} else {
return false;



<a class="box_setting fa fa-ban" style="cursor:pointer;" id="'.$id.'" onClick="confirmDelete(\'/www/site/m_delete.php?id='.$id.'\')"></a>


For opening the page in same tab use this code:-'/www/site/m_delete.php?id=' + aa +'', '_self'); // _self refers to window/tab that the code is currently running