codeigniter - Javascript delete validation whether "Ok" or "Cancel" -


hi guys i'm working on delete validate function in javascript. here code.

  function confirmdelete(){ var agree = confirm("are sure want delete file?");   if(agree == true){     return true } else{ return false; } } 

the alert dialog box comes out whenever press "cancel" button still deletes file in table

here html:

<a href=".base_url()."main/delete?id=$row->id>"."<i class='icon-trash' rel = 'tooltip' title = 'delete' id = 'delete' onclick = 'confirmdelete();'></i></a>"; 

i'm using codeigniter way appreciated! guys! :)

try use return statement calling javascript function. below:

<a href=".base_url()."main/delete?id=$row->id>"."<i class='icon-trash' rel = 'tooltip'   title = 'delete' id = 'delete' onclick = 'return confirmdelete();'></i></a>"; 

Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

How to get multiresult with multicondition in Sql Server -