"$.ajax is not a function" Error When Using jQuery and Darren Johnstone's ASP.NET Upload/Download Module v2
Lately I've been working with an excellent file upload library for ASP.NET written by a guy named Darren Johnstone. This library allows you to upload files and see a modal dialog and progress bar which indicates the percentage of the file upload having been completed. It doesn't use Flash (or Silverlight for that matter), just good ol' server-side .NET and some AJAX on the client-side.
However, it also killed some existing jQuery code I had in place to make some AJAX calls to WCF services. I found I was now getting the following script error:
$.ajax is not a function
My workaround was to change my jQuery code to not use the $ abbreviation. So, in other words, I changed $.ajax to jQuery.ajax -- then it started working again. I'm not sure what it is about the upload control that affected this, but the workaround is manageable. Now I'll just need to explain to everyone why my code uses the long version instead of the shorter one anytime someone says to me "Hey, how come you just didn't write $.ajax?"
You can check out Darren Johnstone's upload module here.
However, it also killed some existing jQuery code I had in place to make some AJAX calls to WCF services. I found I was now getting the following script error:
$.ajax is not a function
My workaround was to change my jQuery code to not use the $ abbreviation. So, in other words, I changed $.ajax to jQuery.ajax -- then it started working again. I'm not sure what it is about the upload control that affected this, but the workaround is manageable. Now I'll just need to explain to everyone why my code uses the long version instead of the shorter one anytime someone says to me "Hey, how come you just didn't write $.ajax?"
You can check out Darren Johnstone's upload module here.
Comments
I have been looking everywhere for the source code for Darren's file upload. The download link from his blog does not work. I was able to find the .cs files but not the javascript files. Do you happen to have any of that? Thanks so much.
Post a Comment