function Getusernamelist () {//Get blacklist user name
var blist;
$.ajax ({
Async:false,
Type: "POST",
URL: "/pay/getusernamelist.do?",
Cache:false,
TIMEOUT:60 * 60 * 1000,
DataType: "JSON",
Success:function (Result) {
if (result! = null) {
Blist = result;
Usernamelist = result;
}
else {
Blist = null;
}
}
});
return blist;
blacklist = blist;
}
Background
[HttpPost]
Public Jsonresult getblacklist ()
{
list<string> list = new list<string> ();
for (int i = 0; I < blacklist. length;i++)
{
String str = Blacklist[i];
List. ADD (str);
}
var a = Json (list);
return Json (list);
}
Complete Ajax
function Search () {
var blist1 = getblacklist ();//blacklist name
var ulist = getusernamelist ();//blacklist user name
var payoutstate = $ ("#txtPayOutState option:selected"). Val ();
var Selectconditon = $ ("#txtSelectConditon option:selected"). Val ();
var usertypestate = $ ("#userTypeState option:selected"). Val ();
Inquire
$.ajax ({
Async:true,
Type: "POST",
URL: "/pay/getpayoutmanagementlist.do?" Radom= "+ $.date.now (),
Cache:false,
TIMEOUT:60 * 60 * 1000,
DataType: "JSON",
Data: {
Payoutcreatebegintime:encodeuri ($ ("#txtPayOutCreateBeginTime"). Val ()),
Payoutcreateendtime:encodeuri ($ ("#txtPayOutCreateEndTime"). Val ()),
Payoutstate:encodeuri (Payoutstate),
Usertypestate:encodeuri (Usertypestate),
Auditcreatebegintime:encodeuri ($ ("#txtAuditCreateBeginTime"). Val ()),
Auditcreateendtime:encodeuri ($ ("#txtAuditCreateEndTime"). Val ()),
Selectconditon:encodeuri (Selectconditon),
Keyword:encodeuri ($ ("#txtKeyWord"). Val ()),
Pagesize:encodeuri ($ ("#txtPageSize"). Val ()),
Currentpage:encodeuri ($ ("#txtCurrentPage"). Val ()),
Token: ' @ (Sltoken.gettoken ()) '
},
Success:function (Result) {
$ (". Sldatatable. Sldatatablerow"). Remove ();
if (result! = NULL && result. Message = = "@ (slstandardmessage.success)") {
$ ("#TotalCount"). HTML (result. TotalCount);
$ ("#TotalMoneyQuantity"). HTML (result. totalmoneyquantity);
$ ("#TotalAvailableAmount"). HTML (result. Totalavailableamount);
$ ("#TotalFreePayOutMoneyQuantity"). HTML (result. totalfreepayoutmoneyquantity);
$ ("#TotalUsedFreePayOutMoneyQuantity"). HTML (result. totalusedfreepayoutmoneyquantity);
$ ("#txtMaxPage"). Val (result. MaxPage);
var currentpage = parseint ($ ("#txtCurrentPage"). Val ());
if (CurrentPage > result. MaxPage && result. maxpage!=0) {
$ ("#txtCurrentPage"). Val (1);
Search ();
}
if (result. Rows! = null) {
for (var i = 0; I < result. Rows.length; i++) {
var row = result. Rows[i];
var rowhtml = $ (". Sldatatabletemplate"). html ();
if (row. state = = ' @ (business.slpayoutstate. Withdraw application. ToString ()) ') {
if (row. Iscompany = = ' 1 ')//company user
{
rowhtml = Rowhtml.replace ("{Ten}", "<a class= ' sldatatablerowedit ' key= ' {key} ' > Confirm </a>|<a class= ' Sldatatableroweditcancel ' key= ' {key} ' > Cancel </a> ');
rowhtml = Rowhtml.replace ("{18}", "");
}
else {
rowhtml = Rowhtml.replace ("{Ten}", "<a class= ' sldatatableroweditcancel ' key= ' {key} ' > Cancel </a>");
}
}
else {
rowhtml = Rowhtml.replace ("{10}", "");
}
if (row. state = = ' @ (business.slpayoutstate. Withdraw application. ToString ()) ' && ($.inarray (row. Cardname, blist1) = =-1 && $.inarray (row. UserName, Ulist) (==-1)) {
rowhtml = Rowhtml.replace ("{}", "<a class= ' sldatatablerowedit1 ' key= ' {key} ' > click submit </a>");
} else {
rowhtml = Rowhtml.replace ("{18}", "");
}
Looping through the set of data per row
rowhtml = Rowhtml.replace (/{key}/g, row.id);
rowhtml = Rowhtml.replace (/{name}/g, row. UserName);
rowhtml = Rowhtml.replace (/{userid}/g, row. UserID);
rowhtml = Rowhtml.replace ("{0}", row. No);
rowhtml = Rowhtml.replace ("{1}", row. UserName);
rowhtml = Rowhtml.replace ("{2}", row. moneyquantity);
rowhtml = Rowhtml.replace ("{3}", row. Fee);
rowhtml = Rowhtml.replace ("{4}", row. Availableamount);
rowhtml = Rowhtml.replace ("{5}", row. Createtime);
rowhtml = Rowhtml.replace ("{6}", row. Auditcreatetime);
rowhtml = Rowhtml.replace ("{7}", row. Type);
rowhtml = Rowhtml.replace ("{8}", row. Auditorname);
rowhtml = Rowhtml.replace ("{9}", row. State);
rowhtml = Rowhtml.replace ("{One}", row. Bankname);
rowhtml = Rowhtml.replace ("{"}, row. Cardname);
rowhtml = Rowhtml.replace ("{$}", row. Cardnumber);
rowhtml = Rowhtml.replace ("{+}", row. Provincename);
rowhtml = Rowhtml.replace ("{}", row. CityName);
rowhtml = Rowhtml.replace ("{+}", row. Districtname);
rowhtml = Rowhtml.replace ("{+}", row. Subbranchname);
rowhtml = Rowhtml.replace ("{OrderID}", row.id);
rowhtml = Rowhtml.replace ("{+}", row. freequantity);
rowhtml = Rowhtml.replace ("{$}", row. freepayoutmoneyquantity);
rowhtml = Rowhtml.replace ("{+}", row. usedfreepayoutmoneyquantity);
rowhtml = Rowhtml.replace ("{$}", row. remainfreepayoutmoneyquantity);
$ (". Sldatatable"). Append ($ (rowhtml). html ());
}
} else {
$ (". Sldatatable"). Append ($ (""));
}
}
else {
$ (". Sldatatable. Sldatatablerow"). Remove ();
}
}
});
}
MVC jquery Ajax