none
Windows Azure Mobile Service HTML/JS RRS feed

  • Pergunta

  • When i try to connect my Phonegap (Html/JS) app on a Windows Azure database, i receive the following error: "Error: Undefined". I really don't know what is happening, here is my code:

    HTML:

        <html>
        <head>
            <meta charset="utf-8" />
            <meta name="format-detection" content="telephone=no" />
            <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
    
            <link rel="stylesheet" type="text/css" href="css/index.css" />
    
            <script src='http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.9.1.min.js'></script>
            <script src='cordova-2.5.0.js'></script>
            <script src="https://wcpush.azure-mobile.net/client/MobileServices.Web-1.0.0.min.js"></script>
            <title>Hello World</title>
        </head>
        <body>
            <div class="app">
                <h1>PhoneGap</h1>
                <div id="deviceready" class="blink">
                    <p class="event listening">Connecting to Device</p>
                    <p class="event received">Device is Ready</p>
                </div>
            </div>
            <script type="text/javascript" src="phonegap.js"></script>
            <script type="text/javascript" src="js/index.js"></script>
            <script type="text/javascript" charset="utf-8" src="PushNotification.js"></script>
            <script type="text/javascript">
                app.initialize();
            </script>
        </body>
    </html>


    JS:

        try {
              //Windows Azure Connection
              var client = new WindowsAzure.MobileServiceClient(
              "key1",
              "key2"
        );
    
        var item = { text: "Test" };
        client.getTable("Item").insert(item);
    
    
        } catch (ex) {
              navigator.notification.alert('Error: ' + ex.description);
        }


    The rest of the code is working fine.

    **** I downloaded the Windows Azure Mobile Service Example and hosted it on localhost and it works fine, but when i compiled it on a Phonegap app i get the same error that i mentioned before.

    I think it can be a CORS problem, but how can i get the domain of the app? Once it'll be a lot of apps in a lot of diferents devices. 

    Thanks for your attention!

            
    quinta-feira, 24 de outubro de 2013 16:15