Reputation: 10493
I am using jQuery 1.7.1 and ColdFusion 9.1
I am using a jQuery function to call a CFC that returns a structure. Here's how I call the CFC:
var jro = new jsMenu();
var Menu = jro.checkMenu();
Here is the results of the Menu variable:
{"ISVALIDPAYMENT":true,"ISVALIDWRAPUP":false}
I need to parse this in jQuery and am having trouble accessing the values.
The following have not worked for me:
var IsValidPayment = Menu.DATA[0][0];
var IsValidPayment = Menu.DATA[0];
var IsValidPayment = Menu.[0];
var IsValidPayment = Menu[0];
var IsValidPayment = Menu.IsValidPayment;
var IsValidPayment = Menu.IsValidPayment[0];
var IsValidPayment = Menu.IsValidPayment.[0];
How should I reference this variable?
Upvotes: 3
Views: 344
Reputation: 120198
Im assuming you have parsed the response string and have an object literal.
var isValidPayment = Menu.ISVALIDPAYMENT
and
var isValidWrapup = Menu.ISVALIDWRAPUP
should work.
If it doesn't you probably need to parse the response to get an object literal.
Upvotes: 4