0

im using the blueimp jquery file upload plugin . this code

<script>
    $('#fileupload').bind('fileuploadsubmit',function(e,data){
        var inputs = data.context.find(':input');
        if (inputs.filter('[required][value=""]').first().focus().length){
            return false;
        }
        data.formData = inputs.serializeArray();
    });
                </script>    

is supposed to send all files along with the form data to the server. For some reason its not working . Firebug says ReferenceError: $ is not defined when this page is loaded. Should i define this callback in the main js ? ( I am able to add additional form data for the selected files when uploading and save the names onto the database. When using titles for each uploaded file these values are sent saved as typed when uploaded one by one. When uploaded all at once the value is the same as the first input. This callback supposedly uploads thses data one by one.

4
  • Did you include the jqueryFile before inserting your own js? otherwise you have to change the order of your script files. Commented Aug 20, 2013 at 22:20
  • yes i did. doesnt work. Im pretty new to jquery. Should i define fileuploadsubmit in a seperate js file ? Commented Aug 20, 2013 at 22:21
  • try using jQuery rather than $ Commented Aug 20, 2013 at 22:23
  • ddnt work.. Could you please have a look at the jsfiddle code i attached ? thanks Commented Aug 20, 2013 at 22:28

2 Answers 2

1

As shown in your jsfiddle, all the script includes are placed at the bottom of the page. So you either move them before your script tags, or you move your script tags to the bottom of the page. Otherwise jQuery will not be defined when you want to use it.

Sign up to request clarification or add additional context in comments.

Comments

0

Fix this :

(e, data>  

to

 (e, data)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.