Johnnybossboy Johnnybossboy - 8 months ago 86
Javascript Question

jQuery word export error

I am using the jquery-word-export plugin (developed by Marks Windoll) to export my webpage to a .doc document. Everything works fine in Google Chrome, but not in Mozilla Firefox. I am getting the following error when I click the export button:

SyntaxError: export declarations may only appear at top level of a module


The strange thing is, it works sometimes by refreshing the webpage.

What does this mean and how can I solve this? Is there another solution (using another export library perhaps)

EDIT: my code is as follows:

<div id="export-content">
<div id="divProfielfoto" ng-controller="profielfotoCtrl">
<img id="profielfoto" ng-src="{{profielfoto}}" alt="profielfoto" style="width: 125px;height:125px;margin-bottom: 20px; border-radius:50%; border: 7px solid orange;" /></div>
<input style="display: none;" id="profileUpload" type="file" accept="image/*"/>
<button class="word-export" onclick="export()">Export as .doc</button>

and the code for exporting is as follows:

$(".word-export").click(function (event) {
$("#export-content").wordExport("CV " + naam);

Answer Source

I have found the answer. In the beginning the path to the profile picture was nothing. After you upload a profile picture (and the path points to a valid picture) everything works