1

私はDOJOを初めて使用し、Dojoの公式Webサイトのドキュメントに従って、POSTリクエストのコードを以下のように書きました。しかし、それは機能せず、「Unable to load myURL status: 0」というエラーが表示されます。助けてください。

 require(["dojo/request","dojo/dom","dojo/on"],function(request,dom,on){

    try{
//Access TextFields Value
var txt_UserName=dom.byId("usrName");
var txt_Password=dom.byId("password");

//Attaching click event on Button   
on(dom.byId("loginButton"),"click",function(evt){
    //alert(txt_UserName.value);
    request.post(myURL,{
        handleAs: "json",   
        data:{
            userId: txt_UserName.value,
            password: txt_Password.value,
        },
        headers:{
            "Content-Type": "application/x-www-form-urlencoded",
        }
    }).then(function(response){
        alert(response);
    },

    function(error){

        alert(error);
    }
);

});

}
catch(error){

    alert(error.message);
}});
4

0 に答える 0