posting rename
author:
contributor:
published:
updated:
source uri:
Summary
//DEF FBID FROM FORM
acre.start_response(200,{"content-type":"text/plain"})
//acre.write(acre...
acre.start_response(200,{"content-type":"text/plain"})
//acre.write(acre...
Content
//DEF FBID FROM FORM
acre.start_response(200,{"content-type":"text/plain"})
//acre.write(acre.environ)
var obj = acre.environ.params;
//var obj = mjt.formdecode(acre.environ.request_body)
function entry(fbid,vote,text){return {fbid:fbid, vote:vote, text:text}}
// function post(entry){ var res = acre.urlfetch("http://acretables.appspot.com/data/vote", "POST",
// {"content-type":"application/json"},JSON.stringify([entry])) return res}
try {
function post(e){
e = [e]
acre.write(JSON.stringify(e))
var res = acre.urlfetch("http://acretables.appspot.com/data/vote", "POST",
{"content-type":"application/json"},JSON.stringify(e))
return res
}
}
catch (e) {
// application('errormsg') = ("Error name: " + e.name + ". Error description: " + e.description + ". Error number: " + e.number + ". Error message: " + e.message);
}
acre.write(JSON.stringify(entry(obj.fbid, obj.vote, obj.text)))
// var res = post(entry(obj.fbid, obj.vote, obj.text))
// var json = JSON.stringify(res.body)
// if (json.action != "ok"){acre.write("fail\n")}
// }
acre.start_response(200,{"content-type":"text/plain"})
//acre.write(acre.environ)
var obj = acre.environ.params;
//var obj = mjt.formdecode(acre.environ.request_body)
function entry(fbid,vote,text){return {fbid:fbid, vote:vote, text:text}}
// function post(entry){ var res = acre.urlfetch("http://acretables.appspot.com/data/vote", "POST",
// {"content-type":"application/json"},JSON.stringify([entry])) return res}
try {
function post(e){
e = [e]
acre.write(JSON.stringify(e))
var res = acre.urlfetch("http://acretables.appspot.com/data/vote", "POST",
{"content-type":"application/json"},JSON.stringify(e))
return res
}
}
catch (e) {
// application('errormsg') = ("Error name: " + e.name + ". Error description: " + e.description + ". Error number: " + e.number + ". Error message: " + e.message);
}
acre.write(JSON.stringify(entry(obj.fbid, obj.vote, obj.text)))
// var res = post(entry(obj.fbid, obj.vote, obj.text))
// var json = JSON.stringify(res.body)
// if (json.action != "ok"){acre.write("fail\n")}
// }
Recent Discussions about posting
There is no discussion about this document.
Start the Discussion »