<a href="/delete/<?php echo $prod_name; ?>" onClick="dropItem()">delete</a>
Now is it true that only if the function dropItem return true will the page be redirected to the url given in the href attribute? If not then can anyone suggest any method to implement this kind of thing. i.e only when the java script returns true the page redirection happens.