var vtr = new Request.JSON({
url: root + '/abc/def/ghi/component.cfc?method=tmcu&id=' + ID,
onRequest: function(){// works fine..
$('tmc').set('text','Calculating...');
},
onComplete: function(json, text){
json = JSON.decode(json);
if(json == null){
json = JSON.decode(text);
}
if (typeOf(json) != 'object' || typeOf(json.tmc) == 'null') {
// ...check to see what kind of error was returned.
jsonDataSessionCheck(json);
}else {
if([11,40].contains(json.bc.toInt()) && ! [11,40].contains($('bc').get('text').trim().toInt())){
myParent().$('ocr').fakeEditClick();
}else if (! [11,40].contains(json.bc.toInt()) && [11,40].contains($('bc').get('text').trim().toInt())){
myParent().$('ocr').fakeEditClick();
}else{
$('tmc').set('text',json.tmc); // THIS IS SUPPOSED TO CHANGE THE TEXT OF AN ELEMENT. IT'S NOT.
$('bc').set('text',json.bc); // THIS IS SUPPOSED TO CHANGE THE TEXT OF AN ELEMENT. IT'S NOT. }
}
}
})
--
---
You received this message because you are subscribed to the Google Groups "MooTools Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mootools-user...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Er. Maybe my mootools is a little rusty but.
https://github.com/mootools/mootools-core/blob/master/Source/Request/Request.JSON.js
This will fire an error event when it fails to parse the response.
request.json automatically passes the object/array. No need to do so manually or just use request.js itself.
Most errors with this tend to be to do with invalid response or content-type issues. validate the response in console and json validators, ensure it's not 204 nocontent etc.
onComplete is supposed to always fire, though.