diff --git a/WebContent/html/javascript/request.js b/WebContent/html/javascript/request.js index 94a01ad..62ebde9 100644 --- a/WebContent/html/javascript/request.js +++ b/WebContent/html/javascript/request.js @@ -1,5 +1,8 @@ //get all the option buttons -var options = document.getElementsByClassName('option'); + +var hardwareOptions = document.getElementsByClassName('hw-data-type'); +var softwareOptions = document.getElementsByClassName('sw-data-type'); + function ajaxFunction(){ var request; @@ -87,13 +90,17 @@ for(var a = 0; a < options.length; a++){ //when an option is selected, show a new list of devices based on what the user asked for function show(){ - //get the option that you selected - var type = this.getAttribute('data-type'); + + currentFilter = readFilter(); + selectedDevices = getDevices(currentFilter); //when connor is done with the database library getDevices should be redirected there + + + var html = ''; //iterate through the hardcoded device DB and select all the ones that match the selected option for(var i = 0; i < devices.length; i++){ - if((type.localeCompare(devices[i].hardware) == 0 || type.localeCompare(devices[i].software) == 0) && !isUnavailable(i)){ + if((hw_type.localeCompare(devices[i].hardware) == 0 && sw_type.localeCompare(devices[i].software) == 0) && !isUnavailable(i)){ html += '
' + devices[i].description + '
Choose an option to the left to begin requesting!
Choose an option to the left to begin requesting!
Added to Cart
-Already in Cart
-