I am using AJAX to call data from a Coldfusion cfc. I am receiving the data from the cfc; however, when I try to apply the data to an object, I am getting an error in the console,
Cannot read property 'myvarname from cfc' of undefined
Here is the code that I am using:
// find value of id and name
$j(".dig3").on("click", function(e) {
var ProgramId = '<cfoutput>#SESSION.id#</cfoutput>';
$j.ajax({
cache: false,
type: 'GET',
url: 'cfc/cfc_myCFC.cfc?method=qProgram&returnformat=json',
dataType: "json",
data: {
program_id: ProgramId
},
success: function(data) {
$j("#programID").val(data[i].ProgramId);
$j("#mailform-input-myvarname").val(data[i].myvarname);
}
});
$j("#formName").dialog("open");
});
Am I structuring something wrong here? Any help is appreciated.