O'Reilly logo

Mastering Cloud Development using Microsoft Azure by Marco Parenzan, Roberto Freato

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Sending data to the service

The page is loaded and buttons are available to vote for the session. Pressing a Vote button is an invocation to the service to add a new row in the table, passed as a JSON object:

    function vote_session(url: string, session_id: string, vote: string): void {
        var mobileAppsClient = new WindowsAzure.MobileServiceClient(url);
        var sessionsVotesTable = mobileAppsClient.getTable("SessionsVotes");
        sessionsVotesTable.insert({
            session_id: session_id
            ,
            vote: vote
        });
    }

The function is referenced once per button; specifically, the Vote button refers to:

$(document).find("#vote_more").click(function () { var id: string =/\d+/.exec(/id=\d+/.exec(document.URL)[0])[0]; vote_session("http://sqlsat495.azurewebsites.net", id, "more"); }); ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required