[英]error in creating query string using anchor tag
当我使用锚标记传递查询字符串时,我得到了我的 url,但问题是 processorId=51 正在重复我的字符串就像这样 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);
}
});
最后我得到了解决方案
$('.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('?'));
}
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.