jQuery AJAX with two domains

Posted by Andrew Burns on Stack Overflow See other posts from Stack Overflow or by Andrew Burns
Published on 2010-05-25T19:11:09Z Indexed on 2010/05/25 19:21 UTC
Read the original article Hit count: 293

Filed under:
|

OK here is the situation: I have an externally hosted CMS which works great for 99% of our needs. However on the more advanced things I inject my own CSS+JS and do magic. The problem I am running into is loading a simple HTML page from jQuery.ajax() calls. It appears to work in the sense that no warnings or errors are thrown; however in my success handler (which IS ran), the response is blank!

I have been scratching my head for the whole morning trying to figure this out and the only thing I can think of is that is has something to do with the cross domain issue (even though it appears to work).

Injected JavaScript:

$(document).ready(function() {
    doui();
});
function doui() {
    $.ajax({
        url: 'http://apps.natronacounty-wy.gov/css/feecalc/ui.htm',
        cache: false,
        success: ajax_createUI,
        charset: "utf-8",
        error: function(e) {
            alert(e);
        }
    });
}
function ajax_createUI(data, textStatus) {
    alert(data);
    $("#ajax-content").html(data);
}

My ajax_createUI() success handler is called and textStatus is "success"; however data is empty.

This JS file resides @ http://apps.natronacounty-wy.gov/css/js/feecalc.js however the CMS website (which gets the JS injected into it) resides @ http://www.natronacounty-wy.gov/

Am I just being stupid or is it a bug that it looks like it should be working but isn't?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about AJAX