Click here to Skip to main content
15,848,555 members
Home / Discussions / Web Development

Web Development

ZurdoDev10-Mar-17 7:53
professionalZurdoDev10-Mar-17 7:53 
Member 1178652210-Mar-17 8:12
Member 1178652210-Mar-17 8:12 
Member 117865228-Mar-17 2:29
Member 117865228-Mar-17 2:29 
ZurdoDev10-Mar-17 7:54
professionalZurdoDev10-Mar-17 7:54 
QuestionMake up of a single web with react Pin
Orlando.Net1-Mar-17 9:29
Orlando.Net1-Mar-17 9:29 
AnswerRe: Make up of a single web with react Pin
Nathan Minier2-Mar-17 3:32
professionalNathan Minier2-Mar-17 3:32 
QuestionRe: Make up of a single web with react Pin
ZurdoDev10-Mar-17 7:55
professionalZurdoDev10-Mar-17 7:55 
QuestionJavaScript - Help Me Understand Pin
Kevin Marois28-Feb-17 8:54
professionalKevin Marois28-Feb-17 8:54 
I have no experience at all with JavaScript. Please help me understand some things....

I'm looking at this small SignalR example.

About halfway down is the HTML, including some JavaScript.

1) First, there seems to be 4 or 5 completely different & unrelated things in this 'function', like a proxy reference, references to the Name dialog that pops up, and variables to store the DisplayName and Message, and the connection stuff???Confused | :confused: Confused | :confused: How can this all be in the same block of code??Confused | :confused: Confused | :confused:

2) What does the dollar sign mean/do?

3) There are numerous 'function' words that are nested?? Please explain this. Seems bizarre.
   <script type="text/javascript">
        $(function () {

        // Declare a proxy to reference the hub.
        var proxy = $.connection.chatHub;

        // Create a function that the hub can call to broadcast messages. 
         <== Client side call back function. The server calls this
        proxy.client.broadcastMessage = function (name, message) {
            // Html encode display name and message.
            var encodedName = $('<div />').text(name).html();
            var encodedMsg = $('<div />').text(message).html();
            // Add the message to the page.
            $('#discussion').append('<li><strong>' + encodedName
                + '</strong>:&nbsp;&nbsp;' + encodedMsg + '</li>');

        // Get the user name and store it to prepend to messages.
        $('#displayname').val(prompt('Enter your name:', ''));

        // Set initial focus to message input box.

        // Start the connection.
        $.connection.hub.start().done(function () {
            $('#sendmessage').click(function () {
                // Call the Send method on the hub.
                proxy.server.send($('#displayname').val(), $('#message').val());
                // Clear text box and reset focus for next comment.

4) In this, " var chat = $.connection.chatHub;", how does the client know about the chatHub??? There are no other references to 'chatHub' outside this, except for the hub itself. How does this work? How does this code know about the hub?

If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.

AnswerRe: JavaScript - Help Me Understand Pin
Nathan Minier28-Feb-17 10:38
professionalNathan Minier28-Feb-17 10:38 
GeneralRe: JavaScript - Help Me Understand Pin
Kevin Marois28-Feb-17 11:45
professionalKevin Marois28-Feb-17 11:45 
GeneralRe: JavaScript - Help Me Understand Pin
Nathan Minier1-Mar-17 1:58
professionalNathan Minier1-Mar-17 1:58 
QuestionSchemas Pin
Member 1302472026-Feb-17 6:53
professionalMember 1302472026-Feb-17 6:53 
AnswerRe: Schemas Pin
BrunoFaitalaas6-Mar-17 1:17
BrunoFaitalaas6-Mar-17 1:17 
AnswerRe: Schemas Pin
camillebo16-Jun-17 14:35
camillebo16-Jun-17 14:35 
QuestionMVC Refresh A Grid Pin
Kevin Marois22-Feb-17 11:51
professionalKevin Marois22-Feb-17 11:51 
AnswerRe: MVC Refresh A Grid Pin
Richard Deeming23-Feb-17 5:04
mveRichard Deeming23-Feb-17 5:04 
QuestionMVCGrid.Net Column Width Pin
Kevin Marois21-Feb-17 14:31
professionalKevin Marois21-Feb-17 14:31 
QuestionRe: MVCGrid.Net Column Width Pin
Richard MacCutchan21-Feb-17 23:10
mveRichard MacCutchan21-Feb-17 23:10 
QuestionWebsite Build Help!! Please Pin
Member 1300832617-Feb-17 16:22
Member 1300832617-Feb-17 16:22 
AnswerRe: Website Build Help!! Please Pin
Afzaal Ahmad Zeeshan17-Feb-17 22:09
professionalAfzaal Ahmad Zeeshan17-Feb-17 22:09 
SuggestionRe: Website Build Help!! Please Pin
Richard Deeming18-Feb-17 2:22
mveRichard Deeming18-Feb-17 2:22 
QuestionAngular JS code Not work Pin
Member 1300557216-Feb-17 5:44
Member 1300557216-Feb-17 5:44 
AnswerRe: Angular JS code Not work Pin
Richard MacCutchan16-Feb-17 6:37
mveRichard MacCutchan16-Feb-17 6:37 
GeneralRe: Angular JS code Not work Pin
Nathan Minier16-Feb-17 7:33
professionalNathan Minier16-Feb-17 7:33 
GeneralRe: Angular JS code Not work Pin
Richard MacCutchan16-Feb-17 8:45
mveRichard MacCutchan16-Feb-17 8:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.