Updating js plugins
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
|
||||
(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);
|
||||
Reference in New Issue
Block a user