2

Whenever I launch my Windows Store application, I get an error that 'alert' is undefined. I'm trying to query a table in Azure Mobile Services and make a list out of the column "type_of_service" from that table.

var typeOfServiceTable = client.getTable('TypeOfService');

// Create a list of type of services
var query = typeOfServiceTable.select("type_of_service").read().done(function (results) {
     alert(JSON.stringify(results));
}, function (err) {
     alert("Error: " + err);
})
cdalto
  • 797
  • 1
  • 15
  • 33
  • Also, I am using this page as a reference. [link](http://azure.microsoft.com/en-us/documentation/articles/mobile-services-html-how-to-use-client-library/#querying) – cdalto Apr 16 '14 at 02:33
  • 1
    I've not written anything for Win8 but my guess is that in that environment `alert` is not defined, thus the `alert` is undefined message. `alert` is not part of JavaScript, it is actually part of the DOM, so environments that are not a web browser are not guaranteed to have it. Same goes for `setTimeout` and `setInterval`; more non-browser environments do implement those, but not all. – Useless Code Apr 16 '14 at 02:40
  • 2
    This question has essentially already been answers, [see the answer here][1] [1]: http://stackoverflow.com/questions/13652413/what-is-the-alternative-to-alert-in-metro-apps – Volte Apr 16 '14 at 02:56

1 Answers1

3

alert() can not be used on Windows Store application.

Instead of using alert(), try the following function:

var msg = new Windows.UI.Popups.MessageDialog("Hello Windows!");
msg.showAsync();
Tamura
  • 1,788
  • 1
  • 14
  • 10