我想在 phonegap 应用程序中使用 jquery 访问 Web 服务。但响应为 0
这是我的代码
$(function () {
$("#callAjax").click(function () {
$.ajax({
type: "POST",
//url: "http://ws.geonames.org/postalCodeSearchJSON?postalcode=90210&maxRows=10",
url: " http://64.15.136.251:8080/onestatus/webservice/login?email=kk@kk.com&password=123456",
// data: ({ name: theName }),
data: ({}),
cache: false,
//dataType: "text",
dataType: "json",
success: onSuccess
});
});
$("#resultLog").ajaxError(function (event, request, settings, exception) {
$("#resultLog").html("Error Calling: " + settings.url + "<br />HTPP Code: " + request.status);
});
function onSuccess(data) {
var result = $.parseJSON(data);
var arrayObject = new Array();
for (i = 0; i < result.user.length; i++) {
$('#employeeList').append('<li>' + result.user[i].response + '</li>');
$('#employeeList').append('<li>' + result.user[i].user_id + '</li>');
$('#employeeList').append('<li>' + result.user[i].session_id + '</li>');
}
}
});
我的代码有什么问题