【发布时间】:2011-10-14 03:00:30
【问题描述】:
在我的 phonegapp-ed android 应用程序中发送以下请求适用于 GET 但不适用于 POST。 使用 GET,一切正常。使用 POST,请求通过,但 POST 变量 在服务器端没有通过,服务器返回一个 json 响应显示“未提供参数”。
POST 在我们的移动应用中运行良好 - 它只是我们遇到问题的 phonegap 应用。我在这里想念什么???提前感谢您提供的任何帮助!
我已经尝试更改 $.ajax 调用、android 清单以及我能想到的所有设置。
另外,我使用的是 Android 2.2 和 Phonegap 1.0
function goTeam(){
var dataString={lat:currentLocation.lat(),lng:currentLocation.lng()}; // this all works
$.ajax({
url: 'http://example.com/request/goTeam',
data: dataString,
dataType: 'json',
success:
function(b) {
if(b.status==1){ // woo hoo! it works
} else {
// the request went through but something was wrong - this is what i'm getting with POST
}
},
type: 'post', // works with GET, doesn't work with POST
error: function(jqXHR, textStatus, errorThrown){ alert("Noooo."); }
});
【问题讨论】: