When I start my project and it loads up my page, I get the following error:
0x800a138f - JavaScript runtime error: The value of the property '$' is null or undefined, not a Function object.
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestPage.aspx.cs" Inherits="WebsiteTest.TestPage" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Web Service Test</title>
<script src="http://ajax.microsoft.com/ajax/jQuery/jquery-2.1.1.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$('#tbDetails').hide();
$('#btnClick').click(function () {
alert('test');
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<input type="button" id="btnClick" value="Get Data" />
<table id="tbDetails">
<thead style="background-color: #DC5807; color: White; font-weight: bold">
<tr style="border: solid 1px #000000">
<td>Description</td>
<td>Comments</td>
</tr>
</thead>
<tbody>
</tbody>
</table>
</form>
</body>
</html>
I'm assuming, it's got something to do with JQuery not being included even though it should be.
Any idea what the problem might be?
Thanks.
Update:
Works when using
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
Will keep researching it as to why it won't work with the MS one! It is definitely there as I can download it!
Update
I figured out 2 problems:
I was using https on my localhost and I should have used the https of jquery. Changing this got rid of my original error but it gave me some other error that I'm still researching.
My code works perfectly (and more since I've open this thread) as now I'm also calling a REST web service and manipulating the data returned without a single error but this only works in Chrome and Firefox! What the hell is up with IE11
$( ... )
wrapper around the code in your inline script block.$(function() { ... })
means exactly the same thing as what was suggested in the (now deleted) comment.<script>
tags, but even those look fine here.