API Docs for: 最后更新日期:2014年8月25日
Google搜索   
Show:

LAjax Class

Defined in: net/LAjax.js:1

Available since 1.7.1

AJAX is the art of exchanging data with a server, and update parts of a web page - without reloading the whole page.

Constructor

LAjax

() public

Defined in net/LAjax.js:1

Available since 1.7.1

Item Index

Methods

Methods

get

(
  • url
  • data
  • oncomplete
  • onerror
)
public

Defined in net/LAjax.js:16

Available since 1.7.1

The method loads data from the server using a HTTP GET request.

Parameters:

  • url String

    Required. Specifies the URL you wish to request

  • data Json Object

    Optional. Specifies data to send to the server along with the request

  • oncomplete Function

    Optional. Specifies a function to run if the request succeeds

  • onerror Function

    Optional. Specifies a function to run if the request failure

Example:

LInit(1000/50,"legend",800,450,main);
var label;
function main(){
    label = new LTextField();
    addChild(label);
    label.x = label.y = 50;
    label.text = "LAjax.get ......";
    LAjax.get("test.txt",{},success);
}
function success (data) {
    label.text = data;
}

post

(
  • url
  • data
  • oncomplete
  • onerror
)
public

Defined in net/LAjax.js:43

Available since 1.7.1

The method loads data from the server using a HTTP POST request.

Parameters:

  • url String

    Required. Specifies the URL you wish to request

  • data Json Object

    Optional. Specifies data to send to the server along with the request

  • oncomplete Function

    Optional. Specifies a function to run if the request succeeds

  • onerror Function

    Optional. Specifies a function to run if the request failure

Example:

LInit(1000/50,"legend",800,450,main);
var label;
function main(){
    label = new LTextField();
    addChild(label);
    label.x = label.y = 50;
    label.text = "LAjax.post ......";
    LAjax.post("test.txt",{},success);
}
function success (data) {
    label.text = data;
}