首页 > 代码库 > ajax方法data参数

ajax方法data参数

一、字符串

data: "begin=" + $("#dateStart").val() + "&end=" + $("#dateEnd").val() + "&rank=" + $("#selectTime").val() + "&PsNet=" + $("#selectPsNet").val() + ‘&pageIndex=‘ + pageIndex + ‘&items_per_page=‘ + items_per_page,

 

二、JSON对象

data: filter,

var filter =
{
"begin": $("#dateStart").val(),
"end": $("#dateEnd").val(),
"rank":$("#selectTime").val() ,
"PsNet" : $("#selectPsNet").val(),
‘pageIndex‘: pageIndex ,
‘items_per_page‘: items_per_page
}

var filter =
{
begin: $("#dateStart").val(),
end: $("#dateEnd").val(),
rank: $("#selectTime").val(),
PsNet: $("#selectPsNet").val(),
pageIndex: pageIndex,
items_per_page: items_per_page
}

 

三、自定义对象

data: filter,

var filter = new QueryFilter(pageIndex, items_per_page);
filter.begin = $("#dateStart").val();
filter.end = $("#dateEnd").val();
filter.rank = $("#selectTime").val();
filter.PsNet = $("#selectPsNet").val();

 

function QueryFilter(pageIndex, items_per_page) {
var filter = new Object;
filter.begin = "";
filter.end = "";
filter.rank = "";
filter.PsNet = "";
filter.pageIndex = pageIndex;
filter.items_per_page = items_per_page;
return filter;
}

ajax方法data参数