Click here to Skip to main content
15,888,610 members
Home / Discussions / Web Development
   

Web Development

 
AnswerRe: PHP WITH BIOMETRIC Pin
ZurdoDev10-Mar-17 6:53
professionalZurdoDev10-Mar-17 6:53 
GeneralRe: PHP WITH BIOMETRIC Pin
Member 1178652210-Mar-17 7:12
Member 1178652210-Mar-17 7:12 
QuestionPHP MYSQL UPDATE ISSUE Pin
Member 117865228-Mar-17 1:29
Member 117865228-Mar-17 1:29 
AnswerRe: PHP MYSQL UPDATE ISSUE Pin
ZurdoDev10-Mar-17 6:54
professionalZurdoDev10-Mar-17 6:54 
QuestionMake up of a single web with react Pin
Orlando.Net1-Mar-17 8:29
Orlando.Net1-Mar-17 8:29 
AnswerRe: Make up of a single web with react Pin
Nathan Minier2-Mar-17 2:32
professionalNathan Minier2-Mar-17 2:32 
QuestionRe: Make up of a single web with react Pin
ZurdoDev10-Mar-17 6:55
professionalZurdoDev10-Mar-17 6:55 
QuestionJavaScript - Help Me Understand Pin
Kevin Marois28-Feb-17 7:54
professionalKevin Marois28-Feb-17 7: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 () {

<pre>
        // 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.
        $('#message').focus();

        // 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.
                $('#message').val('').focus();
            });
        });
    });




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?

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