Js Error, loading the tutorial
Closed this issue · 2 comments
Hi Jako,
I got an error in the console while trying to run your add-on: Uncaught TypeError: Object [object Object] has no method 'ajaxUpload'
I'm trying to insert this AjaxUpload into an existing Formit form. I added the snippet call, hooks- and prehook parameters as in the readme. I can confirm both js and html is loaded in the page:
<div id="file-uploader-image">
<div class="file-uploader-items">
</div>
<div class="file-uploader-buttons">
<noscript>
<input type="file" name="image" />
</noscript>
</div>
</div>
...
<script type="text/javascript" src="/assets/components/ajaxupload/js/fileuploader.js"></script>
<script type="text/javascript" src="/assets/components/ajaxupload/js/ajaxupload.js"></script>
<script type="text/javascript">
/* <![CDATA[ */
$(document).ready(function() {
$('#file-uploader-image').ajaxUpload({
uploadAction: '/assets/components/ajaxupload/connector.php',
uid: 'image',
dragText: 'Drop files here to upload.',
uploadButtonText: 'Upload',
cancelButtonText: 'Cancel',
failUploadText: 'Failed',
deleteText: 'Delete',
clearText: 'Delete all',
hideShowDropArea: true,
thumbX: '75px',
thumbY: '75px',
allowedExtensions: ['jpg','jpeg','png','gif'],
sizeLimit: 8388608,
maxFiles: 3,
messages: {
typeError: "Unfortunately the file(s) you selected weren't the type we were expecting. Only {extensions} files are allowed.",
sizeError: "{file} is too large, maximum file size is {sizeLimit}.",
minSizeError: "{file} is too small, minimum file size is {minSizeLimit}.",
emptyError: "{file} is empty, please select files again without it.",
onLeave: "The files are being uploaded, if you leave now the upload will be cancelled."
}
});
});
/* ]]> */
</script>
</body>
What am I doing wrong?
Edit:
Running Revo 2.2.8-pl
Fixed it; I already loaded jQuery in the head of the page (and had addJqeury=No
), apparently it should be before the body closing tag. This fixed it.
(There was another way to fix it; replace $ for jQuery in core/components/ajaxupload/templates/web/script.tpl)
Nice that you solved it.
If you don't use another Javascript framework $ does not have to be replaced by jQuery.