Cannot read property 'toJSON' of undefined

I am trying to add a button to create a webmerge doc in a new window. The code below is returning the following error in console: Cannot read property 'toJSON' of undefined

Does anyone have any ideas?

I am a very new-learning-to-code person so forgive me if this is obvious.



$(document).on('knack-scene-render.scene_211', function(event, scene) {

$('#view_575 .view-header').after('<div style="padding:15px"><a href="#" id="webmerge" class="kn-button">Download Document</a></div>');

// link hander: send to webmerge
$('#webmerge').click(function(event) {

// get data
var data = Knack.models.view_462.toJSON(data);



url: '',
data: {
field_241: data.field_241,
field_119: data.field_119,
field_118: data.field_118,
field_117: data.field_117,
field_68: data.field_68,
field_69: data.field_69,
field_70: data.field_70,
field_71: data.field_71,
field_72: data.field_72,
field_73: data.field_73,
field_74: data.field_74,
field_75: data.field_75,
field_76: data.field_76,
field_77: data.field_77,
field_78: data.field_78,
field_79: data.field_79,
field_114: data.field_114,
field_80: data.field_80,
field_81: data.field_81,
field_82: data.field_82,
field_83: data.field_83,
field_84: data.field_84,
field_85: data.field_85,
field_86: data.field_86,
field_120: data.field_120,
field_87: data.field_87,
field_88: data.field_88,
field_115: data.field_115,
field_89: data.field_89,
field_90: data.field_90,
field_91: data.field_91,
field_92: data.field_92,
field_93: data.field_93,
field_94: data.field_94,
field_95: data.field_95,
field_96: data.field_96,
field_97: data.field_97,
field_98: data.field_98,
field_99: data.field_99,
field_100: data.field_100,
field_101: data.field_101,
field_102: data.field_102,
field_103: data.field_103,
field_104: data.field_104,
field_106: data.field_106,
field_107: data.field_107,
field_108: data.field_108,
field_109: data.field_109,
field_111: data.field_111,
field_112: data.field_112,
field_113: data.field_113,
field_231: data.field_231
type: 'POST',
success: function() {
window.location = url;


As far as I know, you cannot use Knack.models to access views that are not in the current scene. You'll have to make a GET request to get the data instead like so:

No - it's in another scene (175) - how would I add the scene?

View 462 is not loading because it is returning as an invalid API it because of the scene? or do I need to add code for access token request?

Is view_462 in scene_211?