ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

jQuery in a local server

March 14, 2008 12:35am

Subscribe [2]
  • #1 / Mar 14, 2008 12:35am

    Edemilson Lima

    241 posts

    I installed recently the AppServ in my Windows. It is a software that install the last versions of Apache, PHP and MySQL and make them ready to use. But I noticed that a Javascript using jQuery is throwing this error:

    [Exception… “‘Permission denied while calling XMLHttpRequest.open’ when calling method: [nsIDOMEventListener::handleEvent]” nsresult: “0x8057001e (NS_ERROR_XPC_JS_THREW_STRING)” location: “<unknown>” data: no]

    It is working fine at my production server, but not locally. Can’t jQuery AJAX run locally? The code is:

    $('#email').blur(function() {
        $('#login_msg').hide();
        var user_email=$('#email').val();
        if(user_email) {
            if(validate(user_email,'email*')) {
                $.post(
                    'http://www.domain.tld/login/ajax/',
                    { email: $('#email').val() },
                    function(data,textStatus) {
                        if(data) {
                            $('#login_msg').html(data).fadeIn('slow');
                        }
                    }
                );
            } else {
                $('#login_msg').html('Invalid Email address: '+$('#email').val()).fadeIn('slow');
            }
        }
    });

    I remember that in my own AJAX script, the XMLHttpRequest return 0 (zero) instead of 4 for success, when it runs in a local server. I don’t know why, but maybe this is the problem. Any idea?

  • #2 / Mar 14, 2008 12:44am

    Edemilson Lima

    241 posts

    I found the error… I was making it POST to my domain addres, so it will not work as HttpXMLRequest cannot load from another server… Already fixed.

  • #3 / Mar 14, 2008 6:40am

    George Ornbo

    272 posts

    Yep - a well know GOTCHA. You can’t do cross-domain requests yet. Firefox 3 is looking to support it I think which could lead to some very interesting mashups.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases