Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
36
rated 0 times [  37] [ 1]  / answers: 1 / hits: 16482  / 9 Years ago, wed, december 16, 2015, 12:00:00

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();
});

More From » jquery

 Answers
26

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.


[#64048] Monday, December 14, 2015, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
marisela

Total Points: 103
Total Questions: 105
Total Answers: 102

Location: Solomon Islands
Member since Fri, Oct 8, 2021
3 Years ago
;