I am creating an object using Parse's API and am confused on how and where to use it in my Javascript code.
**Parse API:**
This is an *example* of how to create an object stated 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 trying to use AJAX to send a POST request which appends some text to a list item.
**My Javascript code:**
button.click(function(){ // Submitting text from a textbox
$.ajax({
url : 'https://api.parse.com/1/classes/', // What is className?
type: 'POST',
data: text.val(), // Text the user inputted in a textbox
error: function (data) {
console.log('error');
},
success: function (data) {
$('ul').append('
' + data + '
');
}
});
});
How and where would I use the curl request like the example in my code? Also, I do not know what Parse means by 'className' in the url key. If the ul's class name that I wanted the text to appear in was called "message" then would url key in my AJAX request be 'https://api.parse.com/1/classes/Messages'?
Any help is appreciated! Thanks en.wikipedia.org/wiki/Same_origin_policy
以上就是Parse's API says to use a curl request. I want to use AJAX的详细内容,更多请关注web前端其它相关文章!