索引.xml
<Alloy>
<Window class="container">
<Label id="label">login here</Label>
<TextField id="txtUser">username</TextField>
<TextField id="pwd">password</TextField>
<Button id="btnLogin" onClick="doLogin"></Button>
</Window>
</Alloy>
index.js
function doLogin(e) {
var name = $.txtUser.value.toString();//txtUser is my textbox id
var paswd = $.pwd.value.toString(); //pwd is my textbox id
var jsonobject = {"username":'"'+name+'"',"password":'"'+ paswd+'"'};
var url="api.usergrid.com/DHEERAJ123/DEMO1/logs?";
var client = Ti.Network.createHTTPClient({
onload:{ },
onerror :{ }
});
client.setRequestHeader('content-type', 'JSON');
client.open("POST", url);
client.send(JSON.stringify(jsonobject));
}
$.index.open();
apigee baas output
{
"uuid": "6f07d50a-c48b-11e4-939c-ab932c123bc7",
"type": "logs",
"created": 1425706387024,
"modified": 1425706387024,
"metadata": {
"path": "/logs/6f07d50a-c48b-11e4-939c-ab932c123bc7"
},
"password": "\"888\"", // i had sent 888 but it come .....
"username": "\"dheeraj\""// i had sent dheeraj but it save.....
}
当我通过最终用户使用钛合金在 apigee 中插入数据时,apigee 中的数据没有以正确的格式保存,apigee 中的附加 \ 和“”即将到来......如何克服这个问题......