Hi,
I am using the code below to create a pdf via Docuprint. It creates the file fine, but comes up with the error message, and the spinner doesn't disappear. Where am I going wrong?
Cheers
Craig
$(document).on('knack-scene-render.scene_98', function(event, scene) {
$('#view_182').before('<div style="padding:15px"><a href="#" id="pdf" class="kn-button">Send to pdf</a></div>');
// link hander: send to pdf
$('#pdf').click(function(event) {
event.preventDefault();
// get data
var data = Knack.models['view_182'].toJSON();
log('data!');log(data);
Knack.showSpinner();
$.ajax({
url: 'https://dashboard.docupilot.app/documents/create/04f1b0bd/123e0a3a',
data: {
issue: data.field_9_raw,
otherinfo: data.field_17_raw,
},
type: 'POST',
success: function() {
alert('pdf Created!');
Knack.hideSpinner();
},
error: function() {
alert('There was an error creating the pdf');
}
});
});
});