title: Refreshing JSON input in Select Box after Resolve / Promise in Sweet Alert 2
body: <p>I have a sweet alert 2 select input box that is populated by an external JSON file</p>
  
  <pre><code>var inputOptionsPromise = new Promise(function(resolve) {
      setTimeout(function() {
          $.getJSON("http://localhost/so/categories.json", function(data) {
              resolve(data)
          });
      }, 500)
  })
  </code></pre>
  
  <p>This JSON file contains a list of categories one can choose, or a last option of key value pair of <code>"Add Category +"</code></p>
  
  <pre><code>title: 'Select Category',
  input: 'select',
  inputClass: 'swal-select-category',
  inputPlaceholder: 'Please Select',
  inputOptions: inputOptionsPromise,
  inputValidator: (value) =&gt; {
      return new Promise((resolve) =&gt; {
          if (value === '') {
              resolve('You need to input a category!');
          } else if (value === 'Add Category +') {
              alertify.prompt('Category Name', '', function(evt, value) {
                  $.ajax({
                      type: "POST",
                      async: false,
                      url: 'http://localhost/sa/resources/scripts/addcategory.php',
                      data: {
                          data: value
                      },
                      success: function() {
                          alertify.success('Category ' + value + ' Added.');
                          resolve(value + ' Category Added');
                      },
                      failure: function() {
                          alert("Error Adding Category!");
                          resolve('Error!');
                      }
                  });
              }, function() {
                  resolve('You need to input a category!');
              });
          } else {
              resolve()
          }
      })
  }
  </code></pre>
  
  <p>As you can see if the user chooses the select option <code>Add Category +</code>, a pop-up input box that performs an AJAX request to a PHP page to append whatever input (new Category) to this JSON file.</p>
  
  <p>This works as intended, and a user can either choose a pre-existing category in the JSON file or add a Category to the JSON file using the mentioned option.</p>
  
  <p>After all this work, though, an unfortunate pitfall in this case, is that the input box/JSON is not refreshed once a new Category is appended to the JSON file.</p>
  
  <p>If a user refreshes the page, or exits the sweet alert 2 queue again, it reloads the JSON and displays the new category inputted -- but not whilst in the sweet alert 2 existing dialogue box that the user is expecting to choose his or her category in.</p>
  
  <p>Is it possible to refresh my <code>inputOptionsPromise</code> var to get the new JSON values within the inputValidator or Resolve?</p>
  
  <p>I've added a custom class to the sweet alert 2... must I use some hack-ish jquery solution to possibly refresh the select options or is there a better way to go about getting refreshed JSON data while entering and exiting a promise/resolve?</p>