How JustAnswer Works:
  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site. Ask follow up questions if you need to.
  • Go back-and-forth until satisfied
    Rate the answer you receive.
Ask Ameen Khan Your Own Question
Ameen Khan
Ameen Khan,
Category: Programming
Satisfied Customers: 6600
Experience:  Senior IT Support Specialist at Brookfield Asset Management
101830517
Type Your Programming Question Here...
Ameen Khan is online now

Im using bootstrap 4 and I have created a dropdown menu with

Customer Question

hi
JA: Hello. How can I help?
Customer: Im using bootstrap 4 and I have created a dropdown menu with a list of directors, i have a JSON file with movies listed so I want to store inside a variable the dropdown choice , then use that variable to compare it with the JSON file and list films linked to that specific director
JA: Is there a specific language you're coding in?
Customer: javascript, html
JA: What's your objective for this JavaScript project?
Customer: To print out a list of movies by director choice from the dropdown menu
JA: Anything else you want the Programmer to know before I connect you?
Customer: nope
Submitted: 6 days ago.
Category: Programming
Expert:  Ameen Khan replied 6 days ago.

Hi! My name is Ameen and I'll be assisting you. Secure Remote Assistance is NOT REQUIRED (But Helpful)

I am sorry you are having this concern, I will do my best to help you today.

 

To answer your question ->

​Follow the steps from this link below

-------------

Let me know if you have any follow up questions. I am here to help you.

Customer: replied 6 days ago.
This doesnt help my problem. I am using Javascript and bootstrap 4
Expert:  Ameen Khan replied 6 days ago.

You want to know how to print out a list? you mean export?

Customer: replied 6 days ago.
No, I have this bootstrap html.. <li class="nav-item dropdown ml-auto">
<a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown" id=" ">Director</a>
<div class="dropdown-menu dropdown-menu-right">

<a href="#" onclick="director()" class="dropdown-item"> John Woo</a>
<a href="#" onclick="director()" class="dropdown-item"> P.J. Hogan </a>
<a href="#" onclick="director()" class="dropdown-item"> Gus Van Sant</a>
<a href="#" onclick="director()" class="dropdown-item"> James L. Brooks </a>

and this method..


function director() {
var moviesObj1;
var xhttp = new XMLHttpRequest();
var results = "";


xhttp.onreadystatechange = function() {

if (this.readyState == 4 && this.status == 200) {
var moviesTxt1 = this.responseText;
moviesObj1 = JSON.parse(moviesTxt1);


for (var i = 0; i < moviesObj1.length; i++) {
if (moviesObj1[i].Director == ) {

console.log(moviesObj1[i].Year);
console.log(moviesObj1[i].Title);

results += '<br>' + moviesObj1[i].Year + ': ' + moviesObj1[i].Title;
}
}
}

document.getElementById('demo').innerHTML = results;
};
xhttp.open("GET", "movies.json", true) //used generator here
xhttp.send();
}

I want to be able to store inside a variable my dropdown option I will select so i can place that inside my method and compare my JSON movies database file against my choice of dropdown and print out movies related to this director