I am currently facing a challenge in utilizing Parse's API to create an object within my Javascript code.
For reference, here is the Parse API documentation:
An illustration of creating an object as described in Parse's API:
curl -X POST \
-H "X-Parse-Application-Id: bLAj1fl7B77TZYo1zv9vIAiUgC19RXgpzsFZeVgM" \
-H "X-Parse-REST-API-Key: PPrIdiqZXMHT1JwveI2AdhsAhGpx7WjXfvYTSYXh" \
-H "Content-Type: application/json" \
-d '{"score":1337,"playerName":"Sean Plott","cheatMode":false}' \
https://api.parse.com/1/classes/GameScore
I'm attempting to incorporate AJAX to send a POST request that adds some text to a list item.
My approach in Javascript:
button.click(function(){ // Triggering submission of text from a textbox
$.ajax({
url : 'https://api.parse.com/1/classes/<className>', // What exactly does className refer to?
type: 'POST',
data: text.val(), // Text entered by the user in a textbox
error: function (data) {
console.log('error');
},
success: function (data) {
$('ul').append('<li>' + data + '</li>');
}
});
});
I am unsure on how and where I should integrate the curl request similar to the provided example into my code. Additionally, I need clarification on the definition of 'className' within the url key specified by Parse. If the ul's class name where I wish the text to be displayed is "message", would the url key in my AJAX request be ''?
Your guidance in this matter would be highly valued. Thank you!