javascript - How to get object value in jquery -
i using croppie jquery plugin.all things going good.after resizing image ,i not able dataurl promise object .please me in this. here screenshot of data getting on click of button. http://prntscr.com/awi9co
the code below
var basic = $('#divloadlogo').croppie({ viewport: { width: 150, height: 50 }, enableorientation: true }); basic.croppie('bind', { url: url, points: [77, 469, 280, 739], }); $("#saveresizeimage").click(function() { var canvasdata = basic.croppie('result', 'canvas'); //this contains promise object $.ajax({ type: 'post', url: '/user/saveresizedcanvasimage', data: '{ "imagedata" : "' + canvasdata + '" }', contenttype: 'application/json; charset=utf-8', datatype: 'json', async: false, success: function(data) { if (data.success) { alert('image resized'); } } }); });
try with:
var basic = $('#divloadlogo').croppie({ viewport: { width: 150, height: 50 }, enableorientation: true }); basic.croppie('bind', { url: url, points: [77, 469, 280, 739], }); $("#saveresizeimage").click(function() { basic.croppie('result', 'canvas').then(function(canvasdata){ $.ajax({ type: 'post', url: '/user/saveresizedcanvasimage', data: '{ "imagedata" : "' + canvasdata + '" }', contenttype: 'application/json; charset=utf-8', datatype: 'json', async: false, success: function(data) { if (data.success) { alert('image resized'); } } }); }); });
Comments
Post a Comment