引导模式 - 远程数据 URL


Bootstrap modal - remote-data url

我有一个使用 php 生成的按钮,它调用引导模式:

echo '<button class="btn btn-primary waves-effect waves-light" data-toggle="modal" data-target="#remote-modal" data-remote="printlist.php?type=rangeddetail&pid='.$pid.'&startdate='.$startdate.'&enddate='.$enddate.'&storeformat='.$storeformat.'&retailer='.$retailer.'">'.$ranged_v.'</a>'

data-remote 属性在 html 中呈现时最终如下所示:

data-remote="printlist.php?type=rangeddetail&pid=xxx&startdate=2016-07-05&enddate=2016-07-12&storeformat='x 1','x2','x3','x 4','x5'&retailer='r x'"

按下按钮时,这会带来错误:

jquery-1.12.0.min.js:2 Uncaught Error: Syntax error, unrecognized expression: 1','x2','x3','x 4','x5'&retailer='r x'

我怎样才能做到这一点?

我找到了它,看起来我不得不包装导致 urlencode 问题的变量:

'printlist.php?type=rangeddetail&pid='.$pid.'&startdate='.$startdate.'&enddate='.$enddate.'&storeformat='.urlencode($storeformat).'&retailer='.urlencode($retailer);