title: Unable to get property 'value' of undefined or null reference from dynamic inputs on modal
body: <p>My modal opens and gets values from an AJAX call that is working perfectly, but then I wish to send those values back to another AJAX call when SUBMIT button is pressed, but when I try to get the values from the modal inputs I am getting: 
  Unable to get property 'value' of undefined or null reference</p>
  
  <p>My button HTML:</p>
  
  <pre><code>&lt;button type="button" name="edit" class="btn btn-primary" id="user-submit" data-dismiss="modal"&gt;Submit&lt;/button&gt;
  </code></pre>
  
  <p>My script:</p>
  
  <pre><code>    &lt;script&gt;
      $('#user-submit').on('click', function () {
  
          var userID = document.getElementById(userID).value;
          var dbpassword = document.getElementById(dbpassword).value;
          var firstname = document.getElementById(firstname).value;
          var lastname = document.getElementById(lastname).value;
          var email = document.getElementById(email).value;
          var phone = document.getElementById(phone).value;
          var username = document.getElementById(username).value;
          var password = document.getElementById(password).value;
          var role = document.getElementById(role).value;
  
          $.ajax
          ({
              url: 'includes/updateuser.php',
              type: 'POST', // send input data and use it inside PHP code using $_POST[''];
              data: {userID: userID}, {dbpassword: dbpassword}, {firstname: firstname}, {lastname: lastname}, {email: email}, {phone: phone}, {username: username}, {password: password}, {role: role},
              dataType: "text", //using json to populate the returned array.
  
              success:function(updateuser) {
                  if(updateuser=="success")
                  {
                      alert("SUCCESS: User Updated Successfully!");
                  }
              },
  
              error:function(updateuser)
              {
                      alert("ERROR: Please try again or call your Systems Administrator");
              }
  
          });
  
      });
      &lt;/script&gt;
  </code></pre>
  
  <p>What am I doing wrong?  Any help will be most appreciated!!! Thank you!!!</p>
  
  <p><a href="https://i.stack.imgur.com/VT4Fk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VT4Fk.png" alt="enter image description here"></a></p>