| 123456789101112131415161718192021222324 |
- (function ($) {
- $.fn.remoteFill = function (target = false) {
- var location = $(this);
- let cep = $(this).parent().find('input').val();
- cep = String(cep).replace(/[^\d]/g, '');
- fetch('/postal/search/' + cep, {
- method: 'GET',
- headers: {
- 'Content-Type': 'application/x-www-form-urlencoded',
- 'X-Requested-With': 'fetch'
- }
- }).then(function (response) {
- let json = response.json();
- return json;
- }).then(function(json){
- target(json)
- });
- };
- })(jQuery);
|