In the process of my code, there are two main steps. The first step involves a user filling in certain fields and then submitting the data to the server using ajax. Once submitted, the server returns an HTML select input that requires the user to choose a value - this marks the second step of the process.
However, I am facing an issue where, when attempting to retrieve the selected value from the select element using JavaScript, it returns null.
The code snippet that I am using to extract the select value works perfectly fine under normal circumstances. It is only when the select element is retrieved via ajax that this problem arises.
Here is the code snippet used to get the select value:
var e = document.getElementById("ordernum");
var num = e.options[e.selectedIndex].value;