Hook up preview in browser call
This commit is contained in:
@@ -202,10 +202,14 @@ define([
|
|||||||
showPreview: function() {
|
showPreview: function() {
|
||||||
var json = App.toJSON();
|
var json = App.toJSON();
|
||||||
|
|
||||||
mailpoet_post_json('newsletter_render.php', { data: json }, function(response) {
|
MailPoet.Ajax.post({
|
||||||
|
endpoint: 'newsletters',
|
||||||
|
action: 'render',
|
||||||
|
data: json,
|
||||||
|
}).done(function(response){
|
||||||
console.log('Should open a new window');
|
console.log('Should open a new window');
|
||||||
window.open('data:text/html,' + encodeURIComponent(response), '_blank');
|
window.open('data:text/html,' + encodeURIComponent(response.rendered_body), '_blank');
|
||||||
}, function(error) {
|
}).fail(function(error) {
|
||||||
console.log('Preview error', json);
|
console.log('Preview error', json);
|
||||||
alert('Something went wrong, check console');
|
alert('Something went wrong, check console');
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user