tags:

views:

696

answers:

3

on one page of my app i get a Type is undefined on the ajax script. why would this be?

EDIT

Type is not defined MicrosoftMvcAjax.js()()Microsof...vcAjax.js (line 6) [Break on this error] Type.registerNamespace('Sys.Mvc');Sys.Mv...reate_AjaxOptions=function(){return {};}

+1  A: 

You can start off by installing Firebug for Firefox - it will give you a better error message complete with a call stack.

Sounds like you are trying to instantiate something that is not defined, perhaps you didn't include a javascript file?

Igor Zevaka
i guess order of the scripts on the page matters?
zsharp
Yes it does. If something is defined in foo.js and bar.js loads before foo.js and calls something in foo.js it will fail.
Igor Zevaka
A: 

I was getting this - 'Type' is undefined. Igor Zeveka gave a nice hint and it worked for me. 'Type' class is defined in MS AJAX library. I was referencing my custom.js file in my html head section. Looks like that was causing this reference issue. I moved my custom.js reference inside section of ScriptManager.

 <asp:ScriptManager ID="ScriptManager1" runat="server">
   <Scripts>       
       <asp:ScriptReference Path="~/MyJscripts/custom.js"  />
   </Scripts>
</asp:ScriptManager>
om
+2  A: 

You have to add a reference to MicrosoftAjax.js as well

<script src="../../Scripts/MicrosoftAjax.js" type="text/javascript"></script>
Peter Gfader