Thank you to everyone who responded to my question. A supervisor just
figured it out. Apparently, something had changed recently that started
breaking our JSON data format.
Please keep in mind that I inherited this code.
Originally, the JSON was being returned as {var1:"val1", var2:"val2"}.
Now, we are slowly discovering more and more code that needs to have the
variables in quotes. This was preventing the onSuccess from firing.
Thank you,
JD
On Friday, January 10, 2014 8:14:08 AM UTC-6, Jack Drysdale Jr wrote:
>
> Sergio,
>
> Thanks for your reply. Absolutely nothing happens when I replace my
> current onSuccess with just console.log. :(
>
> JD
>
> On Thursday, January 9, 2014 7:11:56 PM UTC-6, Sérgio Crisóstomo wrote:
>>
>> Jack, what do you get when you use:
>>
>> onSuccess: function(json, text){
>> console.log(json, text);
>>
>> ? ie, is it empty?
>>
>> /Sergio
>>
>>
>> On Thursday, 9 January 2014 22:28:18 UTC+1, Jack Drysdale Jr wrote:
>>>
>>> Hello, everyone.
>>>
>>> I've got a function that is called whenever specific input field values
>>> are changed. The onRequest is firing, no problem. But the onComplete does
>>> not do anything. At all. I've placed alerts, they don't fire. I used
>>> try/catch, nothing.
>>>
>>>
>>> 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. }
>>>> }
>>>> }
>>>> })
>>>>
>>>
>>> For the life of me, I cannot understand why the onComplete is not
>>> firing. Can anyone think of anything that would prevent onComplete from
>>> firing?
>>>
>>> Thanks,
>>>
>>> JD
>>>
>>>
--
---
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.