arvindvyas / Country-State-Select

It will fetch the countries and according to that fetch the state of that countries, currently it is for countries listing
MIT License
69 stars 78 forks source link

ActionController::InvalidAuthenticityToken at /find_states and find_states #52

Closed sibinx7 closed 3 years ago

sibinx7 commented 6 years ago

Gem: gem 'country_state_select', git: 'git://github.com/arvindvyas/Country-State-Select', branch: :master Rails: 5+ Ruby: 2.4.1

sibinx7 commented 6 years ago

Temporarily fixed with this, but my website sends lots of ajax call to different APIs like Stripe.

    var token = $('meta[name="csrf-token"]').attr('content')
    $.ajaxSetup({
        beforeSend: function(xhr){
            xhr.setRequestHeader('X-CSRF-Token', token)
        }
    })
aldefouw commented 6 years ago

@sibinx7 - Not sure if this is helpful or not, but I am using the gem in a Rail 5 production environment on my own Fork of the project:

https://github.com/aldefouw/Country-State-Select/tree/alcd-development

Works great for me without any authenticity token errors.

arvindvyas commented 3 years ago

Using same but not getting any error