[jQuery] How to load redirected content in dialog?

[jQuery] How to load redirected content in dialog?


I have some content that loads in a dialog popup via ajax. For some
reason when the URL redirects (i.e. 301, 302, etc.), the content never
loads in the dialog. Is this normal behavior for ajax, or should the
redirected content load?
Thanks.
<a href="url_that_redirects" class="myDialog">do something</a>
$(".myDialog").click(function() {
$(this).openDialog();
});
$.fn.openDialog = function () {
var url = $(this).attr("href");
         popup = $(this).dialog();
        $.ajax(
            {
                url: url,
                success: function(message) {
                    popup.html(message);
                },
                error: function() {
                    popup.html("<div class='portlet-msg-error'>The content could not
be loaded.</div>");
                },
                timeout: 20000
            }
        );
        return this;
     };