3

I have a html form with a dropdown list of car models and a blank frame below that. I'd like to display a url related to the selected car in the frame when the submit button is pushed. I have it working and displays the current cars value in the frame, but I don't know how to insert and have JS return a URL value.

the JS goes like this: (and it may be completely wrong as I'm new to this stuff...)

function carFormSelect (form) {
var Car = form.selCar.value;
if (Car == 'Camry'){
document.querySelector('.carSelected').innerHTML = (Car);
}

HTML like this:

<select id="selCar" name="selCar">
                    <option value="Camry">Camry</option>
                    <option value="Corolla">Corolla</option>
</select>

I'm assuming I need the URL to be placed where (Car) is. I tried putting the url in quotes but didn't work. Any help would be greatly appreciated.

Thanks!

3
  • 2
    What URL value are you referring to? Commented Oct 22, 2015 at 14:21
  • 1
    From where url will come? Commented Oct 22, 2015 at 14:21
  • 1
    If you have a frame or iframe, than set the location of that frame Commented Oct 22, 2015 at 14:23

1 Answer 1

1

You can do that by using a JQuery/Ajax request.

You just need to get the value when the user clicks on the Select element and send it to another page that will have a iframe with the treated with the SRC that you want (in that case the car site)

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for the heads-up. Did some research on JQuery site and found this ended up working: $('.carSelected').load("warrantypages/NewCamryWarranty.html" );
Glad to help you @mrmills. If my answer helped you please accept it :)

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.