ReferenceError: Parse is not defined

13,143

I'm sorry, I have no experience with Cordova, but in general I've seen problems like these being caused by live reloading of files or by asynchronous loading, which could be caused by cordova/gulp/nodejs.

Maybe you should use a require statement as shown on the Parse quick start guide: var Parse = require('parse');

When I try your html and javascript in jsfiddle it just works, so it should have something to do with the order of loading js files in your local "webserver".

Share:
13,143
olivier
Author by

olivier

Updated on June 07, 2022

Comments

  • olivier
    olivier almost 2 years

    I get this error with a Parse.com JS App:

    ReferenceError: Parse is not defined.

    I really don't know why. Everything looks good to me. The files are linked correctly; I've checked this a few times. Is it not true, that I have to put my own JS right below Parse and it should work? This is what I've read here: Github Project I use Chrome with the ripple extension. I serve the app via cordova serve

    Any help much appreciated!

    Here is index.html:

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8" />
        <meta name="format-detection" content="telephone=no" />
        <meta name="msapplication-tap-highlight" content="no" />
        <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, target-densitydpi=device-dpi" />
        <link rel="stylesheet" type="text/css" href="../css/index.css" />
        <link rel="stylesheet" type="text/css" href="../css/font-awesome.min.css" />
        <title>Zone</title>
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
        <script type="text/javascript" src="http://www.parsecdn.com/js/parse-latest.js"></script>
        <script type="text/javascript" src="../js/main.js"></script>
    </head>
    
    <body>
        <img src="../img/site-logo.png" rel="external" class="logo">
        <!-- <div class="site-menu">
            <i class="fa fa-angle-double-left"></i><p class="title"></p><i></i>
        </div> -->
        <a href="#"><img src="img/suche.jpg" class="icon"></a>
        <a href="#"><img src="img/essentrinken.jpg" class="icon"></a>
        <a href="#"><img src="img/einkaufen.jpg" class="icon"></a>
        <a href="#"><img src="img/kultur.jpg" class="icon"></a>
        <a href="#"><img src="img/dienstleistungen.jpg" class="icon"></a>
        <a href="#"><img src="img/nuetzlich.jpg" class="icon"></a>
        <a href="#"><img src="img/nummern.jpg" class="icon"></a>
        <a href="#"><img src="img/sport.jpg" class="icon"></a>
        <a href="#"><img src="img/verwaltung.jpg" class="icon"></a>
        <a href="#"><img src="img/hotel.jpg" class="icon"></a>
        <a href="#"><img src="img/neuzuzuger.jpg" class="icon"></a>
    
        <div class="adad"></div>
    
        <script type="text/javascript" src="../cordova.js"></script>
        <script type="text/javascript" src="../js/index.js"></script>
        <script type="text/javascript">
            app.initialize();
        </script>
    </body>
    </html>
    

    And here the JS file.

    $(document).ready(function () {
        Parse.initialize("", "");
    
        var Ad = Parse.Object.extend("Ads");
        function getPosts() {
            var query = new Parse.Query(Ad);
            query.find({
                success: function (results) {
                    console.log("hello");
                    var output = "";
    
                    for (var i in results) {
                        var name = results[i].get("location");
    
                        if (name == 10) {
                            output += "<img src = '" + imageurl + "' class='media-object' height='60' width='100'>"
                        }
                    }
    
                    $("#adad").html(output);
                    console.log(output);
                },
                error: function (error) {
                    console.log("Query error:" + error.message);
                }
            });
        }
        getPosts();
    });
    
  • olivier
    olivier over 8 years
    I found the Solution now... There was a strange error in ripple. The App works well in Chrome DevTools. Even the JS wasn't loaded in ripple (tested with a console.log). Have a good Day and thanks for your time!
  • Robbert van den Bogerd
    Robbert van den Bogerd over 8 years
    No problem, please mark this question as solved. Greetings!