You need to return false to stop the link from following through
$('.mailform').click(function() {
     var myUrl = $(this).attr('href');
     $.fancybox(
        {
            'autoDimensions'    : false,
            'width'             : 350,
            'height'            : 'auto',
            'transitionIn'      : 'none',
            'transitionOut'     : 'none',
            'ajax'   : {
              cache   : false,
              url     : myUrl
             }
        }
    );
    return false;
});
4
solved How to load php page with fancybox? [closed]