0
請幫我解決這個問題 我想轉到另一幀後的HTTP模塊完成其請求裏面。代碼如下:瀏覽HTTP模塊nativescript
var datanya = 'token='+konfigurasi.tokenapps+'&email='+inputan['email']+'&nama='+inputan['nama']+'&handphone='+inputan['handphone']+'&alamat='+inputan['alamat']+'&longitude='+longi+'&latitude='+lat +'&model='+cekPlatform.device.model+'&tipe='+cekPlatform.device.deviceType+'&manufaktur='+cekPlatform.device.manufacturer
+'®ion='+cekPlatform.device.region;
httpModul.request({
url: 'http://example.com/c_user/daftar/',
method: "POST",
timeout: 10000,
headers: { "Content-Type": "application/x-www-form-urlencoded" },
content: datanya
}).then(function(response){
//console.log(JSON.stringify(response));
//console.log(response);
console.log('data diterima : '+response.content);
var jsondata = response.content.toJSON();
console.log('JSON Data hasil '+JSON.stringify(response.content));
loader.hide();
if(jsondata.hasil=='error'){
console.log('error '+jsondata.alasan);
Toast.makeText(jsondata.alasan, "long").show();
}else{
console.log('success : '+jsondata.alasan);
Toast.makeText(jsondata.alasan, "long").show();
//navigate
fm.topmost().navigate("otp/cek_daftar");
console.log('navigation passed');
}
},function(err){
//return error;
Toast.makeText('Error : '+err, "long").show();
console.log(err);
})
但它不會與導航工作。從搜索我得到的信息http模塊使用異步也許它不會與導航使用同步。
謝謝