Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <label for="pozicija">Izaberi poziciju</label>
<select id="pozicija">
  <option value="direktor">Direktor</option>
  <option value="poslovodja">Poslovodja</option>
  <option value="radnik">Radnik</option>
<div id="btn1" class="btn">Povuci podatke sa servera</div>
<div id="output"></div>



                .btn {
  border: 1px solid black;
  padding: 8px;
  display: inline-block;
  margine: 0 auto;
  display: block;
  cursor: pointer;
#output {
  font-size: 24px;
  padding: 15px;
  text-align: center;


                var output = document.getElementById("output");
var btn = document.getElementById("btn1");
var select = document.getElementById("pozicija");

/* deo gde se čuva selectovana opcija iz dropdown-a */
var izborPozicije = "direktor";
select.addEventListener("change", function(){
  izborPozicije = select.options[select.selectedIndex].value;

/* Event handler na dugmetu */
btn.addEventListener("click", function() {
  /* Čišćenje ekrana */
  /* Novi XMLHttpRequest objekat */
  var httpRequest = new XMLHttpRequest();
  /* EventHandler  za ajax request */
  httpRequest.addEventListener("load", function(){
    if (this.status < 400) {
      /* Podaci dobijeni ajaxom */
      var myObj = JSON.parse(this.responseText);
      /* Štampanje samo selektovanih pozicija */
      var izborNiz = myObj.filter(function (obj) {
          return obj.pozicija == izborPozicije;    
       for (let izbor in izborNiz) {
          output.innerHTML += izborNiz[izbor].pozicija + " " + izborNiz[izbor].ime + "<br>";
    } else {
      var greska = new Error("Request failed: " + httpRequest.statusText);
      console.log("Server je OK ali neka greška u transportu");
  }, false);
  /* Otvaranje  konekcije i definisanje parametara */"GET", "", true);
}, false )