0
我在Parse.com上玩了一下,我正嘗試將HTML表單的內容發送到Parse.com 我是一種Javascript noob,所以出於某種原因,我找不到方法將我從表單輸入中獲得的變量傳遞給Parse.com進行處理。 這裏是我的代碼:將表單的輸入傳遞給Parse.com
<div class="main">
<form action="">
<label>Insert your ingridient :</label>
<input type="text" id="text" name="name" value="" />
<input type="button" id="text_value" value="Get Value"/>
<script type="text/javascript">
$(document).ready(function() {
$('#text_value').click(function() {
var text_value = $("#text").val();{
alert(text_value);
}
});
});
Parse.initialize("myAPIKey", "myAPIKey");
var GameScore = Parse.Object.extend("GameScore");
var gameScore = new GameScore();
gameScore.save({
name: text_value,
}, {
success: function(gameScore) {
// The object was saved successfully.
},
error: function(gameScore, error) {
// The save failed.
// error is a Parse.Error with an error code and description.
}
});
</script>
對於初學者,從'alert(text_value)'附近刪除'{'和'}'...... – Darren 2014-08-29 20:59:40