I am trying to post data to mvc controller and i am unsuccessful doing so..hope i get any help…here is the xhrpost call
var reqObj =
{
Id: dojo.byId("Id").value,
Password: dojo.byId("Password").value
};
console.log(reqObj );
var xhrArgs = {
url: '~/FormController/ValidateRequest',
postData: reqObj ,
handleAs: "json",
headers: { "Content-Type": "application/json", "Accept": "application/json"},
load: function (data) {
alert(data);
}
}
var deffered = dXhr.post(xhrArgs);
console.log(deffered);
}
I could not even see a post call in firebug….what might be the problem..any clues?
Thanks in advance.
I see a couple issues:
First you populate
reqObjwith the values you want to post, however, you put “request” into your xhrArgs.Second, you will need to convert
reqObjto json (dojo.toJson), since you are handling the post as json.Also, I don’t see a reference to the dojo.xhrPost method? Are you using sometype of framework that encapsulates that?