Reputation: 41
I am trying to upload file by blueimp file upload.I use very simple code for testing but the code is not working.In firefox error console there is two error
Error: TypeError: $.ajaxTransport is not a function
Error: TypeError: $.support is undefined
Here is my code
<input id="fileupload" type="file" name="picture"/>
<input type='button' id='sub'/>
$('#sub').click(function () {
$('#fileupload').fileupload({
url: 'php/index.php',
// dataType: 'json',
done: function (e, data) {
$.each(data.result.files, function (index, file) {
$('<p/>').text(file.name).appendTo(document.body);
});
}
});
});
And after clicking button another error has occured
Error: TypeError: $(...).fileupload is not a function
That means the plugins function is not working.please help.thanks in advance.
Upvotes: 4
Views: 2395
Reputation: 23264
Press F12 in your browser and look at the network tab to see which scripts are being loaded when you refresh your page. In my case I had jquery being loaded twice, removing one of them fixed the problem for me.
Upvotes: 1
Reputation: 2698
So I'm pretty new to jquery, but I just got the same errors trying to use the same plugin. Looked up ajaxTransport and discovered it was a function actually in jquery, which gave me a pretty good guess that I was using an old version of jquery. Sure enough: VS2010 doesn't update its jquery, so if you create a new project in VS, you get jquery-1.4.1. jquery is up to version 1.10.0 now. Updated my project to that version, the errors went away and my server-side code was called successfully.
Upvotes: 1