This isn't tested, but perhaps using JQuery native methods for the onload callback and ajax will solve the issue.
url: 'partners.php?u=<?php echo $username ; ?>&ajax=true'
alert('An error has occurred with the request.');
If your using JQuery you might as well take full advantage of what it has to offer.