【发布时间】:2014-09-24 11:28:11
【问题描述】:
我正在尝试调用此 Web 服务,但它的响应为空
<script type="text/javascript">
jQuery(document).ready(function(){
var user = {nick :"rajesh", password:"123456", device_id:"123456677"};
jQuery.ajax({
type: "post",
data :JSON.stringify(user),
url: "http://localhost:81/sazpin/user/users/index.json",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(data) {
console.log(data);
}
});
});
</script>
我的 httppost 客户端是
HttpClient httpClient = new DefaultHttpClient();
// post header
HttpPost httpPost = new HttpPost(url);
httpPost.setEntity(se);
httpPost.setHeader("Accept", "application/json");
httpPost.setHeader("Content-type", "application/json");
请有人帮助我如何调用此网络服务并获得响应?
【问题讨论】:
-
网络服务怎么样?我所看到的只是一个 javascript 脚本。 HttpClient 不会调用 javascript
-
请告诉我怎么称呼它
标签: android json web-services