I have the following success call within a jQuery AJAX function.
success: function(data, response) {
var response1 = data['response1'];
var response2 = data['response2'];
var response3 = data['response3'];
var percentage = window.response / 100;
alert(percentage);
}
After the user clicks on a particular button (either response1, response2, or response3) I want to perform some maths with their selected response by working with a dynamic variable window.response.
Unfortunately, I cannot seem to access the value of window.response as alert(percentage) returns 'undefined'. I have tried to access data.response or window['response'] and this doesn't work either.