首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 操作系统 >

js post 交付

2012-08-28 
js post 提交public JSONObject submitAnswer(JSONObject json,String postUrl){String result nulltry

js post 提交

public JSONObject submitAnswer(JSONObject json,String postUrl){
String result = null;
try {
result = ClientBuilder.request(this.context, postUrl, json.toString(), "post");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (IllegalStateException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
System.out.println("/..." + result);
JSONObject jsonObject = null;
try {
jsonObject = new JSONObject("{result:'" + result + "'}");
} catch (JSONException e) {
e.printStackTrace();
}
return jsonObject;
}

?

?

js 端调用上面的方法:

$.phonegap.submitpageId=function(pageName){
var info = {url:pageInfoid+pageName};
$.phonegap.getData({
action: 'submitAnswer',
success: function(op) {
window.Control.closePrograssDialog();
// if(op.result == '200') {
// alert('提交成功');
// } else {
// alert('提交失败');
// }
// alert(op.result);
},
failure: function(msg) {
alert(msg);
window.Control.closePrograssDialog();
},
url: JSON.stringify({list:info, postUrl: '提交的地址?pageInfoName='+pageInfoName+'&deviceId='+deviceId+'&pageInfoid='+pageInfoid})
});
};

热点排行