I'm really new to javascript and ajax, and I'm having syntax error problems somewhere in below code. I tried to find it myself but after few days I need to ask for some good soul to help me as this is almost impossible to me.
<script type="text/javascript">
new AjaxUpload('#button-option-<?php echo $option['product_option_id']; ?>', {
action: 'index.php?route=product/product/upload',
name: 'file',
autoSubmit: true,
responseType: 'json',
onSubmit: function(file, extension) {
$('#button-option-<?php echo $option['product_option_id']; ?>').after('<img src="catalog/view/theme/moshi/image/loading.gif" class="loading" style="padding-left: 5px;" />');
$('#button-option-<?php echo $option['product_option_id']; ?>').attr('disabled', true);
},
onComplete: function(file, json) {
$('#button-option-<?php echo $option['product_option_id']; ?>').attr('disabled', false);
$('.error').remove();
if (json['success']) {
alert(json['success']);
$('input[name=\'option[<?php echo $option['product_option_id']; ?>]\']').attr('value', json['file']);
}
if (json['error']) {
$('#option-<?php echo $option['product_option_id'];
?>').after('<span class="error">' + json['error'] + '</span>');
}
$('.loading').remove();
}
});
</script>
I appreciate any help as I don't know why Dreamweaver shows there is an syntax error
Thanks in advance