2

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

  • why?
  • how can i fix it?

1 Answer 1

2

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");
  });
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.