Add states api endpoint to support existing code on the customer details page when user changes country

This commit is contained in:
Luis Ramos
2020-09-01 15:46:22 +01:00
parent 41d797489d
commit ffa0d202be
6 changed files with 116 additions and 4 deletions

View File

@@ -4,8 +4,7 @@ var update_state = function(region) {
var state_select = $('span#' + region + 'state select.select2');
var state_input = $('span#' + region + 'state input.state_name');
$.get(Spree.routes.states_search + "?country_id=" + country, function(data) {
var states = data["states"]
$.get(Spree.routes.states_search + "?country_id=" + country, function(states) {
if (states.length > 0) {
state_select.html('');
var states_with_blank = [{name: '', id: ''}].concat(states);