I am trying to create a Multi Select ComboBox. Here is my code.
Now my quesry is how can I get the value dynamically. Like from JSON and XML. Current it is hard coded but I want this to be from JSON.
My Code.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Chosen: A jQuery Plugin by Harvest to Tame Unwieldy Select Boxes</title>
<link rel="stylesheet" href="docsupport/style.css">
<link rel="stylesheet" href="docsupport/prism.css">
<link rel="stylesheet" href="chosen.css">
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self' https://ajax.googleapis.com; style-src 'self'; img-src 'self' data:">
</head>
<body>
<form>
<div id="container">
<div id="content">
<div class="side-by-side clearfix">
<div>
<select data-placeholder="Choose a Country..." class="chosen-select" tabindex="4">
<option value=""></option>
<option value="United States">United States</option>
<option value="United Kingdom">United Kingdom</option>
<option value="Afghanistan">Afghanistan</option>
<option value="Aland Islands">Aland Islands</option>
<option value="Albania">Albania</option>
</select>
</div>
</div>
</div>
</form>
</body>
</html>
I want in plain javascript. For that I tried this but don't know how to implement this.
Js Code.
function foo() {
var httpRequest = new XMLHttpRequest();
httpRequest.open('GET', "/rest/computer");
httpRequest.send();
return httpRequest.responseText;
}
Any idea how to get this.