当我使用anchor-tag传递查询字符串时我得到了我的网址,但问题是processorId = 51正在重复twise 我的字符串就是那样 MonthlySettlementAlgorithm / MonthlySettlementResultviewByDate processorId = 51&安培; bankId = 51&安培; bankId = 2866
但我期待
MonthlySettlementAlgorithm / MonthlySettlementResultviewByDate processorId = 51&安培; bankId = 2866
请给我解决方案
+ "<li><a target='_blank' href='/MonthlySettlementAlgorithm/MonthlySettlementResultviewByDate?processorId=' >View By Date</a></li>"
+ "<li><a target='_blank' href='/MonthlySettlementAlgorithm/MonthlySettlementResultViewByBank?processorId=' >View By Bank</a></li>"
Jquery Code
$('.dropdown-menu.features li a').each(function () {
if ($(this).attr('href'))
{
$(this).attr('href', $(this).attr('href') + selectedProcessorIds +'&bankId='+ selectedBankIds);
}
});
答案 0 :(得分:0)
最后我得到了解决方案
$('.dropdown-menu.features li a').each(function () {
var href = $(this).attr('href');
if (href) {
var requiredArray = href.split('?');
if (requiredArray.length > 1) {
var tempProcString = "processorId=" + selectedProcessorIds;
var tempBankString = "&bankId=" + selectedBankIds;
var tempDate = "&snapshotDate=" + $('#txtDate_FirstDateValue').val();
requiredArray[1] = tempProcString + tempBankString + tempDate;
console.log(requiredArray[1]);
}
//finally updating href
$(this).attr('href', requiredArray.join('?'));
}
});