Here’s my code:
function init() {
var request = new NetRequest();
request.open(“GET”, “”);
util.debug(‘Starting Request’);
request.onreadystatechange = function () {
util.debug(‘State Changed’);
}
}
init();
The second util.debug never executes, yet if I go to the url manually in a browser ( is just a placeholder for this posting) it returns the required text.
I know it works, since the weather widget works, but for the life of me I can’t figure it out…
Are you executing request.send()? The request will never be sent to the web server if that isn’t called. It’s easy to forget (don’t ask me how I know)!
Well I’ll be darned. That worked. And yet the documentation states:
i Initiates the request. The optional argument provides the request entity body. The argument is ignored if request method is GET or HEAD.[/i]
I guess I got confused. Thanks!
I think it’s stating that the argument to the send() method is optional, not that invoking the method is optional.
Yeah, and I feel a bit foolish that I misread it. It’s always the simple things, isn’t it?!