"$.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.


Anonymous said…
Hi there,

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.
MyLifeAndCode said…
Sorry for the delay in replying. Yes, I have the source code, though I'm not sure if it's the latest version.
thank u very much for the help.i have been working on this problem for long time but didnt get any solution :). it helps me a lot.thank u again
Anonymous said…
Thanks dude, your post helped me with my problem!
MyLifeAndCode said…
Glad I could help! :)
Anonymous said…
what is the solution to this problem ?
Anonymous said…
This solved my problem. Thanks for the post http://www.cyphernet.co.za

Popular posts from this blog

A Generic Method Using HttpClient to Make a Synchronous Get Request

The Cause and Solution for the "System.Runtime.Serialization.InvalidDataContractException: Type 'System.Threading.Tasks.Task`1[YourTypeHere]' cannot be serialized." Exception