need launch callback after prompt submit

need launch callback after prompt submit


My javascript looks like this:
$(document).ready(function() {
    var user_name = prompt('Please enter your name');
    $.post('users2.php', { user_name: user_name, action: 'joined' });
});



 it post to this php file.
<?
mysql_connect('localhost', 'root', '');
mysql_select_db('jquery');
if (isset($_POST['user_name'], $_POST['action'])) {
echo "hi there";
}
?>







I tried to find a way of using a callback or click method that works with prompt() but I couldn't get anything to work and now I'm too tired to think.