Reputation: 2785
So there I am trying to load an external .js file which in return loads other pages using $.ajax and jQuery Templates. Everything was working when my code was all in a single .aspx page. But after distributing everything to separate clean files I am having this error:
<asp:ScriptManagerProxy ID="ScriptManagerProxy" runat="server">
<Scripts>
<asp:ScriptReference Path="~/Scripts/jquery-1.7.min.js" />
<asp:ScriptReference Path="~/Scripts/jQuery.tmpl.min.js" />
<asp:ScriptReference Path="~/Pages/Templates/Stream/Stream.js" />
</Scripts>
</asp:ScriptManagerProxy>
GetStream();
function GetStream() {
alert('ok');
$.ajax({ /* It reaches this line */
type: 'POST',
But returns the following.
$ is undefined
Please note that I have added the Stream.js file seperately without using the ScriptManagerProxy
below the jquery-1.7 file. And still got the same thing. Ideas?
I forgot to mention that the content of Stream.js is wrapped in:
$(document).ready(function () { });
Upvotes: 0
Views: 632
Reputation: 14501
What is the benefit of using the script manager for this? It's just going to format/output HTML tags.. Why not use HTML instead.
<script language="javascript" src="/Scripts/jquery-1.7.min.js"></script>
<script language="javascript" src="/Scripts/jQuery.tmpl.min.js"></script>
<script language="javascript" src="/Pages/Templates/Stream/Stream.js"></script>
Upvotes: 1
Reputation: 887365
You should reference the external file in the ScriptManagerProxy to make sure they're executed in the correct order.
Upvotes: 0