javascript - grid stack serialisation function not returning -


i trying serialise grids within grid stack container, can see the values held within elements properties not seem want return object properly. when perform ajax post request widget data not being assigned function returning undefined.

window.onbeforeunload = function (e) {         //store grid variable manipulated         this.grid = $('.grid-stack').data('gridstack');          //we create savegrid method save attributes database         this.save_grid = function () {             this.serialized_data = _.map($('.grid-stack > .grid-stack-item:visible'), function (el) {                 el = $(el);                 var gridid = el.find('.grid-stack-item-content.ui-draggable-handle').first().attr('id');                 var node = el.data('_gridstack_node');                 return {                     id: gridid,                     x: node.x,                     y: node.y,                     width: node.width,                     height: node.height                 };             }, this);         };          $.ajax({             url: 'dashboard/editwidgets/',             type: 'post',             data: {                 widget: this.save_grid             },             success: function (dataset) {             },             failure: function (xhr, error) {                 console.log(xhr)                 console.log(error)             },             cache: false         })     }; 


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -