function getData()
{
var data = new PostData(DataModel);
processAjaxRequest('/Home/List', 'Post', 'fetchComplete', data);
}
var DataModel =
{
"AccountName": document.getElementById("Account").value,
"AccountKey": document.getElementById("AccountKey").value,
"Id": document.getElementById("Id").value,
"DateTime": document.getElementById("DateTime").value
}
function processAjaxRequest(urlToProcess, httpMethod, successCallback, postData) {
var dataToPost = '';
if (typeof postData != 'undefined') {
dataToPost = postData.DataToPost;
}
$.ajax({
url: urlToProcess,
type: httpMethod,
data: dataToPost,
success: function (data, status) {
var fn = window[successCallback];
fn(data);
},
error: function (xhr, desc, err) {
processAjaxError(xhr, desc, err);
},
});
}
var PostData = function (dataToPost)
{
this.DataToPost = dataToPost;
}
我在文本框中有价值,但模型的属性仍然为空。