³ÉÈË¿ìÊÖ

Please turn on JavaScript. To find out how to do this visit the .

Returned by post, get async requests and loadScript

Constructor

There is no direct constructor, since post and get create the instances.

Properties

complete

Boolean indicating whether the request has completed

Type

Example

// request.complete with an asynchronous call
var request = glow.net.get(
  "myFile.html", 
  {
    async: true,
    onload: function(response) {
      alert(request.complete); // returns true
    }
  }
);
alert(request.complete); // returns boolean depending on timing of asynchronous call

// request.complete with a synchronous call
var request = glow.net.get("myFile.html", {async: false;});
alert(request.complete); // returns true
nativeRequest

The request object from the browser.

Type

Description

This may not have the same properties and methods across user agents. Also, this will be undefined if the request originated from loadScript.

Example

var request = glow.net.get(
  "myFile.html", 
  {
    async: true,
    onload: function(response) {
      alert(request.NativeObject); // returns Object()
    }
  }
);

Methods

abort

Aborts an async request

Synopsis

myRequest.abort();

Returns

this

Description

The load & error events will not fire. If the request has been made using loadScript, the script may still be loaded but the callback will not be fired.

Example

var request = glow.net.get(
  "myFile.html", 
  {
    async: true,
    defer: true,
    onabort: function() {
      alert("Something bad happened.  The request was aborted.");
    }
  }
);
request.abort(); // returns "Something bad happened.  The request was aborted"
destroy

Release memory from a glow.net.loadScript call.

Synopsis

myRequest.destroy();

Returns

this

Description

This is called automatically by loadScript calls that have {callback} in the URL. However, if you are not using {callback}, you can use this method manually to release memory when the request has finished.

Example

var request = glow.net.loadScript('http://www.bbc.co.uk/whatever.js');
send

Sends the request.

Synopsis

myRequest.send();

Returns

This for async requests or a response object for sync requests

Description

This is done automatically unless the defer option is set

Example

var request = glow.net.get(
  "myFile.html", 
  {
    onload : function(response) {alert("Loaded");},
    defer: true
  }
);
request.send(); // returns "Loaded"

Events

load

Fired when the request is sucessful

Synopsis

glow.events.addListener(myRequest, "load", function(event) {
    // ...
});

Arguments

event
Type
glow.events.Event

Event Object

Description

For a get / post request, this will be fired when request returns with an HTTP code of 2xx. loadScript requests will fire 'load' only if {callback} is used in the URL.

abort

Fired when the request is aborted

Synopsis

glow.events.addListener(myRequest, "abort", function(event) {
    // ...
});

Arguments

event
Type
glow.events.Event

Event Object

Description

If you cancel the default (eg, by returning false) the request will continue. Returned by glow.net.post, glow.net.get async requests and glow.net.loadScript

Further Info & Examples

error

Fired when the request is unsucessful

Synopsis

glow.events.addListener(myRequest, "error", function(event) {
    // ...
});

Arguments

event
Type
glow.events.Event

Event Object

Description

For a get/post request, this will be fired when request returns with an HTTP code which isn't 2xx or the request times out. loadScript calls will fire 'error' only if the request times out.

Documentation generated by 2.1.0 on Thu Jul 07 2011 12:47:29 GMT+0100 (BST)

³ÉÈË¿ìÊÖ iD

³ÉÈË¿ìÊÖ navigation

³ÉÈË¿ìÊÖ Â© 2014 The ³ÉÈË¿ìÊÖ is not responsible for the content of external sites. Read more.

This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.