我有这个片段:
$('#button1').click(function(){
window.location = "details.php?trans=Automatic&&mileage=19,695&&eng=6&&ext=White Platinum Metallic&&stock=45411&&vin=2FMGK5D89DBD08967&&location=Palm Beach, FL&&price=$28,999&&photo=http://content.homenetiol.com/1535/67692/165x10000/2013-Ford-Flex-Limited/d0dbf839ecc3492a850bfc73a6d9099d.jpg";
});
我想在网址中传递图片photo
的网址,但它不起作用
答案 0 :(得分:2)
你需要对所有内容进行编码吗?通过encodeURIComponent
$('#button1').click(function(){
window.location = "details.php?"+ encodeURIComponent("trans=Automatic&&mileage=19,695&&eng=6&&ext=White Platinum Metallic&&stock=45411&&vin=2FMGK5D89DBD08967&&location=Palm Beach, FL&&price=$28,999&&photo=http://content.homenetiol.com/1535/67692/165x10000/2013-Ford-Flex-Limited/d0dbf839ecc3492a850bfc73a6d9099d.jpg");
});