私はdojoでログイン機能を作成しようとしています。私の場合、私はこのケースではextern(!!)サーバーへのPOSTリクエストが必要になります。以下のようにdojoでログインしてexternサーバーにリクエストする
ログインが定義されています
login
Login is a special action, not handling any data, but authenticating a user. A POST request is to be made, containing a json object with keys 'email' and 'password'. The return value is either true or false. A special Cookie is returned for further identification.
Valid API Calls
URL: /api/login
Method: POST
Fields:
password
Description: Returns all data for the logged in user in PLIST format. if login fails, false is returned in PLIST format.
まあ、私はIOでその問題を解決しようとしました。 iframe.send呼び出しが表示されますが、次のエラーが表示されます。エラー:アクセス許可が拒否されました 'getElementsByTagName'
io.iframeが問題を解決する正しい方法であるかどうかはわかりません。
function login(){
require(["dojo/io/iframe", "dojo/dom"], function(iframe, dom){
var email = dom.byId("logEmail").value;
var password = dom.byId("logPassword").value;
function JSONreq(){
var jsonpArgs = {
method: 'POST',
handleAs:"json",
content:{
email: email,
password: password
},
url: "http://---someServerThatIDontWantToName---/api2/login",
load: function (response, ioargs){
//console.log(response)
alert('succes');
},
error: function(response, ioargs){
alert("error");
}
};
iframe.send(jsonpArgs);
}
dojo.ready(JSONreq);
});
};
モバイル開発のいずれかの違いがある:私の現在のコードは次のようになります。
おそらく、あなたは私の どうもありがとう
PSを助けることができますか?クロスサーバポストリクエストは、モバイルデバイス上で可能でなければなりません。
so:この理由でio.iframe.sendを使用できますか?
あなたはJSONP使用したり、domaindに呼び出し、カール – ZiTAL