signalr - MVC 4 java script error unable to get property 'Taskhub' -


i tried display signal r messages on index page. following hub details

 public class taskshub : hub {     public void newtaskdetails(int taskid,string taskname,string created,string role)     {         clients.all.addmessage(taskid, taskname, created, role);      }  }   error : unhandled exception @ line 60, column 9 in http://localhost:45845/  0x800a138f-javascript runtime error: 

unable property taskshub of undefined or null reference

<script src="~/scripts/jquery-1.8.2.js"></script> <script src="~/scripts/jquery.signalr-1.1.0.js"></script> <script src="~/signalr/hubs"></script> <script type="text/javascript"> $(function () {      var thub = $.connection.taskshub;     $messages = $("#messages");     thub.client.send = function (taskid, taskname, created, role) {         $messages.append("<br /><b>" + taskid + ":</b>" + taskname);     }      $.connection.thub.start(); }); 

use camel casing

for example if class name mychathub

then in should call
var chat = $.connection.mychathub;

hope helps , make sure script files loaded , check in global.asax file added

  routetable.routes.maphubs(); 

Comments

Popular posts from this blog

php - mySql Join with 4 tables -

css - Text drops down with smaller window -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -