Can this be done guy?

Below I have my php

PHP Code:
if($_FILES['logo']['name']=="") {
$q24=mysql_query("update category set category_Name='$name', category_metaTitle='$meta', category_Image='$fname2', category_Description='$desc1', category_Active='$active' where cat_Id=$sr") or die (mysql_error());
$conf="Data Updated Successfully 1";
} else {
$q24=mysql_query("update category set category_Name='$name', category_metaTitle='$meta', category_Image='imgdata/category/$fname', category_Description='$desc1' where cat_Id=$sr") or die (mysql_error());
$conf="Data Updated Successfully 2";

At the bottom of each I have a successful call, ($conf="Data Updated Successfully 1") but what I would like to do is call a javascript function instead of the script being called using a button as below.

<input type="button" onclick="javascript:cover();" value="fade now" />
Can this be done