Not getting result using ajax on wordpress

Its looks like you are not printing the admin ajax URL.

add_action('wp_head', 'my_action_javascript');

function my_action_javascript() {
?>
<script type="text/javascript" >
 jQuery(document).ready(function($) {
 var ajaxurl = "<?php echo admin_url('admin-ajax.php'); ?>";
$('.myajax').click(function(){
    var data = {
        action: 'my_action',
        whatever: 1234
    };

    // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
    $.post(ajaxurl, data, function(response) {
        alert('Got this from the server: ' + response);
    });
});


});
</script>
<?php
}

Please see that am printing the admin url using echo. Since there is no URL in ajax call you are getting the whole page.

Additional Info: For non logged in user, use wp_ajax_nopriv