This is my HTML beginning:
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="/Scripts/jquery-1.8.2.min.js"></script>
<script src="/Scripts/jquery.signalR-0.5.3.js" type="text/javascript"></script>
<script src="/Scripts/MyScript.js" type="text/javascript"></script>
<title>Some title</title>
</head>
I tried adding just before </head>:
<script type="text/javascript" src="/signalr/hubs"></script>
But it doesn’t help.
I also tried to remove everything besides jQuery and signalR scripts.
Please note: All scripts, including jquery.signalR-0.5.3.js (and hubs, if I add it) are loaded successfully (I can single step it with Chrome “Developer Tools”).
So why I don’t have $.connection object defined ?
Edit:
I cleaned all unnecessary code, and found out meanwhile that:
$.connectiondoes exist when I’m inMyScript.js, but I tried to test it first using the chrome console. In the console it does not exist… I don’t understand why.-
I save
$.connectionfor the moment, in order to test it, insomeGlobalObj:someGlobalObj = $.connection;and that works…
So my updated question would be: how-come $.connection is visible during my script, but invisible in the chrome console ($, or jQuery are globals) ?
There are only two explanations: Something that executes after your script (a timeout, some other script)…
connectionproperty of the jQuery object$(and evenjQuery?) variables with similiar object(s) which don’t have theconnectionproperty.The second one could be the case if you also use other libraries (like Prototype).