Try this code..
IN PHP Code
echo "<script type='text/javascript'>".
"alert('Success to add the task to a project.');
location.reload;".
"</script>";
IN Javascript
function refresh()
{
alert("click ok to refresh page");
location.reload();
}