Why doesn't my dojo xhr.post request work?

2019-09-05 17:58发布

问题:

I have an xhr post method, but my callback with "alert("data retrieved")" never gets fired and I dont know why.

Here is a fiddle for better reading: http://jsfiddle.net/ZKppc/1/

appPrototype.prototype.requestData = function(url, user, password) {
    var me = this;
    document.getElementById("inputServer").value = url;
    this.definedUrl = url;
    dojo.xhr(
       "http://" + url + "x/y.json",
       {
          handleAs: "json",
          method: "POST",
          data: {
            l_username: user,
            l_password: password},
            preventCache: true
       }).then(function(data) {
        alert("data retrieved");
       },
       function(err){
           me._handleInitError_p(error);
           return error;
      })
};

greets Tom