Skip to content Skip to sidebar Skip to footer

Azure Mobile Services: Basic Read Function In Javascript

I'm learning javascript and windowsazure mobile services. As a learning lesson I created a 'users' table and inserted a test user. I'm actually using icenium to write a demo app

Solution 1:

The options object with the success and error callback objects is only used in server-side scripts. For the client side, the programming model is based on promises, and you should use the done() (or then()) continuation to get the results:

var client = new WindowsAzure.MobileServiceClient('https://mtdemo.azure-mobile.net/', 'YOUR-KEY');
var usersTable = client.getTable('users');
usersTable.where({ userID: 'impretty@blockheaded.com' }).read().done(function (result) {
    $("#uFullName").val(result.name);
}, function (err) {
    $("#uFullName").val('There was an error: ' + JSON.stringify(err));
});

Post a Comment for "Azure Mobile Services: Basic Read Function In Javascript"