Open link in div with problems

Open link in div with problems

I am loading the results of a form into a div.
I am loading URLs into the same div and this works fine, here is the code:

$(function () {
   function ajaxify(file) {
      $('#loading').fadeIn('slow');
      $.get(file,function(data) {
         $("#wrapper").slideUp('slow',function(){
            $(this).html(data).slideDown('slow');
         });
      });
      $('#loading').fadeOut();
   }
   $("a.ajax").click(function(){
      ajaxify($(this).attr('href'));
      return false;
   });      
   $().ajaxStart(function() {
      $('#loading').fadeIn('slow');
   }).ajaxStop(function() {
      $('#loading').fadeOut('slow');
      $('#wrapper').fadeIn('slow');
   });
   $('#ajaxform').submit(function() {
      $.ajax({
         type: 'POST',
         url: $(this).attr('action'),
         data: $(this).serialize(),
         success: function(data) {
            $('#wrapper').html(data).slideDown('slow');
         }
      })
      return false;
   });                  

});


The problem is that I want to load URLs from the form results into the same div but I can't manage to find an answer.

This is how a link which works in the main page looks like:

<a href="script.php?do=this" class="ajax">Do this</a>


I tried the same link in the form results page but it loads it refreshes the page in stead of opening in the div.

I tried putting the javascript code in the results page, but it does not work and it seems to be interfering with the main page code.

Is there a way to do what I want the script to do?

Thanks!