I am building a web app that is controlled from a server. I want the
server to send objects to the app, which the app then processes. I am
using getScript for this, but it doesn't seem to be working for me.
I have example code at //jsbin.com/umuwi

This code calls getScript on the url ://jsbin.com/utake - this returns
the following text:
_jq_action={type:"href"};

I call getScript as follows:

var _jq_action;

$(document).ready(function(){
    _jq_getaction();
});

function _jq_getaction() {
    try {
        _jq_action = null;
        $.getScript("http://jsbin.com/utake";, _jq_processaction);
        _jq_log("sent request");
    } catch(e) {
        alert(e);
    }
}

function _jq_processaction() {
    try {
        _jq_log("got reply");
        if(_jq_action) {
            _jq_log(_jq_action.type + " received");
        } else {
            _jq_log("no action");
        }
    } catch(e) {
        alert(e);
    }
}

_jq_log is a function which merely outputs messages to the screen, so
I can see what is going on.

The request gets sent, but _jq_action is always null.

Nikki Locke

Reply via email to