Javascript button error


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?



$(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) {

// get data
var data = Knack.models['view_182'].toJSON();


url: '',
data: {
issue: data.field_9_raw,
otherinfo: data.field_17_raw,
type: 'POST',
success: function() {
alert('pdf Created!');
error: function() {
alert('There was an error creating the pdf');



Oops I thought you said it won’t appear. For it not disappearing put a short delay in before the remove function and it will disappear.

Hi, It makes no difference. So same result if the spinner function is in the code or not. The file writes correctly; the "success" message doesn't appear; the "error" appears; and the spinner stays spinning.

If you remove the hide spinner function does it appear?

Hi, Yes it is the last line in the array. 

I think you are correct, but still makes no difference if I remove the comma.