0

I have a self hosted parse-server. However I can't seem to do a simple object save in javascript.

My server runs fine and am able to do the parse-server-example.

However, when I try to add a new page it doesn't appear to work.

In my Index.js I have the line

app.get('/testsave', function(req, res) {
    res.sendFile(path.join(__dirname, '/public/simplesave.html'));
});

then in /public/simplesave.html:

<script src="/public/assets/js/simplesave.js"></script>

and finally in /public/assets/js/simplesave.js:

$(function() {

    var TestObject = Parse.Object.extend("TestObject");
    var testObject = new TestObject();
    testObject.save({foo: "bar"}).then(function(object) {
      alert("yay! it worked");
    });

});

Replace this with a xhttp.send() however works. I think I am correct in assuming that Parse does not need to be initialised again and I can simple call Parse.

going to localhost:1337/testsave I would expect the function to be called and a TestObject. However I must be missing something.

1 Answer 1

0

Adding this line to simplesave.html worked:

<script src="https://unpkg.com/parse/dist/parse.min.js"></script>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.