Wrapped Request with automated receiving of JavaScript Objects in JSON Format.
var myJSONRemote = new Request.JSON([options]);
Fired when the request completes. This overrides the signature of the Request success event.
onSuccess(responseJSON, responseText)
Fired when the parsed JSON is not valid and the secure option is set.
onError(text, error)
Fired when the request failed (error status code), or when JSON string could not be parsed.
onFailure(xhr)
xhr - (XMLHttpRequest) The transport instance.
// this code will send a data object via a GET request and alert the retrieved data. var jsonRequest = new Request.JSON({url: 'http://site.com/tellMeAge.php', onSuccess: function(person){ alert(person.age); // alerts "25 years". alert(person.height); // alerts "170 cm". alert(person.weight); // alerts "120 kg". }}).get({'firstName': 'John', 'lastName': 'Doe'});
© Linux.ria.ua, 2008-2024 |