使用cordova-2.0.0 + jquery-1.10.1
尝试在我的 wordpress 博客上获得授权
提出这个要求
$.ajax({
url: "http://mydomain.ru/?json=auth.generate_auth_cookie",
dataType: "jsonp",
jsonpCallback: "myCallback",
success: function (data) {
alert('success');
},
error: function (data) {
alert('error');
}
});
在我的本地主机上,此请求成功
myCallback({"status":"error","error":"You must include a 'username' var in your request."})
但是当我尝试在 Android Emulator 或 Android Device 中发出请求时出现错误
CordovaLog
SyntaxError: Parse error
Web Console
SyntaxError: Parse error at http://mydomain.ru/?json=auth.generate_auth_cookie&callback=myCallback&_=1370343811075:1
权限
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.BROADCAST_STICKY" />
<access origin="http://mydomain.ru" subdomains="true" />