lam afif
lam afif

Reputation: 33

passing url in another url

i have this snippet:

$('#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";
                });

i want to pass the url of image photo in the url but it didn't work

Upvotes: 2

Views: 41

Answers (1)

Nix
Nix

Reputation: 58522

You need to encode everything after ? via 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");
  });

Upvotes: 2

Related Questions