Question: I admit it, I don't know what I'm doing.

I'm attempting to learn how to use SignalR and I'm following various samples online almost verbatim and I can't get pasted $.connection being undefined. I'm working in MVC 4.0 and trying to use either nuget-downloaded signalR js files or those from sample projects. These are my script references.

```
@Scripts.Render("~/Scripts/jquery-1.7.2.min.js")
@Scripts.Render("~/Scripts/knockout-2.0.0.js")
@Scripts.Render("~/Scripts/jquery.signalR.js")
@Scripts.Render("~/signalr/hubs")

```

The scripts seem to load - I've even put alerts at the start of them which fire, but $.connection is always undefined. 

In a bizarre turn of events, I have a different project where I'm trying to use a different jQuery library and it uses $. and that object is ALSO always undefined. 

I'm just looking for any possible explanation of what I might be doing wrong. Thanks very much in advance.

Answer: 
I solved the problem. I know what I did but I don't know why it worked for sure.

I was referencing the main jquery library (version 1.7.2) at the top of the \_Layout.cshtml view, but was not referencing any other jquery scripts. I noticed that by default in the layout view it was loading 

```
@Scripts.Render("~/bundles/jquery") 

```

at the bottom of the view and that a scripts section was located below that.

```
@RenderSection("scripts", required:false)

```

I further changed my script references as shown and put my script references shown in the question above inside a 

```
@section scripts
{    
   @Scripts.Render("~/Scripts/jquery.signalR-0.5.1.js")
   @Scripts.Render("~/Scripts/jquery.color.js")
   @Scripts.Render("~/signalr/hubs")
   @Scripts.Render("~/Scripts/blasht.signalr.js")
}

```

wrapper on my view so that they would be included after the bundles were loaded. I assume that I was not loading all the necessary jquery because now it works.

Now if I can figure out how this applies to my other projects.
The reason this works is because of the order in which the javascript files are loaded. If you try and load jquery.signalR-0.5.1.js before loading jquery, then you will face the $.connection undefined because for this to register the jquery should be loaded first. In the \_Layout.cshtml template the scripts load in the order 

```
@Scripts.Render("~/bundles/jquery")

@RenderSection("scripts", required: false)

```

So inside any of your views you can load signalr under the script section and this should work fine.