GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fixing bug due to block scoping and fixed indenting · LukaszLevy/fullstack-javascript@0795079

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • code/03-parse-sdk
    • app.js
    • index.html
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎code/03-parse-sdk/app.js‎

Copy file name to clipboard
+39-38Lines changed: 39 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,45 @@
11
$(document).ready(function() {
2-
3-
// You define them when you start the Parse server
4-
const parseApplicationId = 'APPLICATION_ID'
5-
const parseJavaScriptKey = 'MASTER_KEY'
6-
7-
Parse.initialize(parseApplicationId, parseJavaScriptKey)
8-
Parse.serverURL = 'http://localhost:1337/parse'
2+
3+
// You define them when you start the Parse server
4+
const parseApplicationId = 'APPLICATION_ID'
5+
const parseJavaScriptKey = 'MASTER_KEY'
6+
7+
Parse.initialize(parseApplicationId, parseJavaScriptKey)
8+
Parse.serverURL = 'http://localhost:1337/parse'
99

10-
const Test = Parse.Object.extend('Test')
11-
const test = new Test()
12-
const query = new Parse.Query(Test)
10+
const Test = Parse.Object.extend('Test')
11+
const test = new Test()
12+
const query = new Parse.Query(Test)
1313

14-
$('.btn-save').click(function(){
15-
try {
16-
const data = JSON.parse($('textarea').val())
17-
} catch (e) {
18-
alert('Invalid JSON')
19-
}
20-
if (!data) return false
21-
test.save(data, {
22-
success: (result) => {
23-
console.log('Parse.com object is saved: ', result)
24-
$('.log').html(JSON.stringify(result, null, 2))
25-
//alternatively you could use alert('Parse object is saved')
26-
},
27-
error: (error) => {
28-
console.log(`Error! Parse.com object is not saved: ${error}`)
29-
}
30-
})
31-
})
14+
$('.btn-save').click(function(){
15+
let data
16+
try {
17+
data = JSON.parse($('textarea').val())
18+
} catch (e) {
19+
alert('Invalid JSON')
20+
}
21+
if (!data) return false
22+
test.save(data, {
23+
success: (result) => {
24+
console.log('Parse.com object is saved: ', result)
25+
$('.log').html(JSON.stringify(result, null, 2))
26+
//alternatively you could use alert('Parse object is saved')
27+
},
28+
error: (error) => {
29+
console.log(`Error! Parse.com object is not saved: ${error}`)
30+
}
31+
})
32+
})
3233

33-
$('.btn-get').click(function(){
34-
query.find({
35-
success: function(results) {
36-
$('.log').html(JSON.stringify(results, null, 2))
37-
},
38-
error: function(error) {
39-
alert(`Error: ${error.code} ${error.message}`)
40-
}
41-
})
42-
})
34+
$('.btn-get').click(function(){
35+
query.find({
36+
success: function(results) {
37+
$('.log').html(JSON.stringify(results, null, 2))
38+
},
39+
error: function(error) {
40+
alert(`Error: ${error.code} ${error.message}`)
41+
}
42+
})
43+
})
4344

4445
})
Collapse file

‎code/03-parse-sdk/index.html‎

Copy file name to clipboard
+26-27Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,37 @@
11
<!DOCTYPE html>
22
<html lang="en">
33
<head>
4-
<script type="text/javascript" src="jquery.js"></script>
5-
<script src="parse-1.11.1.js"></script>
4+
<script type="text/javascript" src="jquery.js"></script>
5+
<script src="parse-1.11.1.js"></script>
66

7-
<script type="text/javascript" src="app.js"></script>
8-
<link type="text/css" rel="stylesheet" href="css/bootstrap.css" />
7+
<script type="text/javascript" src="app.js"></script>
8+
<link type="text/css" rel="stylesheet" href="css/bootstrap.css" />
99

1010
</head>
1111
<body>
12-
<div class="container-fluid">
13-
<div class="row-fluid">
14-
<div class="span12">
15-
<div id="content">
16-
<div class="row-fluid">
17-
<div class="span12">
18-
<div class="hero-unit">
19-
<h1>Parse JavaScript SDK demo</h1>
20-
<textarea cols="60" rows="7">{
21-
"name": "John",
22-
"text": "hi"
12+
<div class="container-fluid">
13+
<div class="row-fluid">
14+
<div class="span12">
15+
<div id="content">
16+
<div class="row-fluid">
17+
<div class="span12">
18+
<div class="hero-unit">
19+
<h1>Parse JavaScript SDK demo</h1>
20+
<textarea cols="60" rows="7">{
21+
"name": "John",
22+
"text": "hi"
2323
}</textarea>
24-
<p><a class="btn btn-primary btn-large btn-save" >Save object</a></p>
25-
<p><a class="btn btn-success btn-large btn-get" >Get objects</a></p>
26-
<pre class="log"></pre>
27-
Go to <a href="https://parse.com/apps/" target="_blank">Parse.com</a> to check the data.
28-
</div> <!-- hero-unit -->
29-
</div> <!-- span12 -->
30-
</div> <!-- row-fluid -->
31-
</div> <!-- content -->
32-
</div> <!-- span12 -->
33-
</div> <!-- row-fluid -->
34-
</div> <!-- container-fluid -->
35-
24+
<p><a class="btn btn-primary btn-large btn-save" >Save object</a></p>
25+
<p><a class="btn btn-success btn-large btn-get" >Get objects</a></p>
26+
<pre class="log"></pre>
27+
Go to <a href="https://parse.com/apps/" target="_blank">Parse.com</a> to check the data.
28+
</div> <!-- hero-unit -->
29+
</div> <!-- span12 -->
30+
</div> <!-- row-fluid -->
31+
</div> <!-- content -->
32+
</div> <!-- span12 -->
33+
</div> <!-- row-fluid -->
34+
</div> <!-- container-fluid -->
3635

3736
</body>
3837
</html>

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.