ポストjsonデータで送信したい。アリアテンプレート - POST経由のコールサービス
私はAPIドキュメント(working in an asynchronous worldとAPI doc IOAsyncRequestCfg)を読んで、彼らはそれがこのように送信されるべきであると言った:
/* called when the template has been successfully rendered. */
$viewReady : function(){
console.log("$viewReady");
var pnr = this.data.pnr;
var names = this.data.names;
var namesResults = [];
if (names.length > 0)
{
var monto = this.callAjaxService('https://localhost/Service1.asmx/SetNames?jsonp=false', names);//REST service
}
},
やサービスへの呼び出しは次のとおりです。
callAjaxService : function (urlString, data) {
console.log("callAjaxService");
console.log(urlString);
console.log(JSON.stringify(data));
aria.core.IO.asyncRequest({
url : urlString,
timeout : 10000,
async: true,
method: "POST",
data: JSON.stringify(data),
contentType: "application/json",
callback : {
fn : this.onSuccessId,
scope : this,
onerror : this.onError,
onerrorScope : this
}
});
},
私はと思いますリクエストがサーバーに到着しないようにするために、リクエストはアリアテンプレートから出てこない。私が得る応答は:
error:"error"
errorText:"Error #2048"
errorType:"securityError" reqId:249
responseText:"undefined"
status:0
statusText:"xdr:error"
私はIIS上でサービスをデバッグしており、決してそこに到着しません。私は他のクライアントとのサービスをテストしたし、それは動作します。
When CORS is enabled, you can use a regular transport, based on XHR. In order to tell Aria Templates to do so, you can execute this code before any cross domain request:
aria.core.IO.updateTransports({ 'crossDomain': 'aria.core.transport.XHR' });
Also, due to the way CORS works to control what HTTP headers can be added to a request by the client, you should also execute this code:
aria.core.IO.useXHRHeader = false;
要求にこれらの2つの行を追加するには、要求がサーバに到着した働かせた:
新しいアプローチ、パートナーがいることを教えてくれました。しかし、今私たちはこのサービスの応答を得ています
error:"13030"
reqId: 255
responseText:""
responseXML:null
status:13030
url:"https://localhost/Service1.asmx/GetNames?jsonp=true&callback=pol
サーバーの応答はJSON構造です。私たちは適切な対応を得るために取り組んでいます。
クロスドメインエラーのように見えます。 CORS用にIISを設定しましたか? –
はいはい...私はパートナー(@ヤニック)によって与えられた新しい良いアプローチをここに投稿します。それはほとんど終わりましたが、私たちはまだレスポンスでこの問題を抱えています... – paulofer85