当前位置: 动力学知识库 > 问答 > 编程问答 >

javascript - How's the JS client API of parse.com working?

问题描述:

I saw this article: http://mobile.dzone.com/articles/playing-parsecom-api, and I liked their example JS code:

var user = new Parse.User();

user.set("username", "ElMacho");

user.set("password", "chicken");

user.set("email", "[email protected]");

user.signUp(null, {

success: function(user) {

// Everything's done!

console.log(user.id);

},

error: function(user, error) {

alert("Error: " + error.code + " " + error.message);

}

});

I'd like to understand how this works, and to confirm my hunch. Did they enable CORS on their servers, to make this possible?

网友答案:

You can check yourself :)

Open up fiddler or some other network traffic analyser. If there is an OPTIONS call made with CORS headers then you will know it is using CORS. I would suggest that it must be if the request is being made cross origin.

分享给朋友:
您可能感兴趣的文章:
随机阅读: