2
I have a form and when typing the ZIP code I show a gif of loading while I carry the street, the neighborhood and etc.
The problem is that as the user descends the form, the gif of the load does not appear, as it is "stuck" at the top of the form giving the impression that the site is stuck.
I would like the upload image to follow the screen, appearing exactly in the middle of the screen, so that the user can see that a load is happening.
I accept other suggestions that suit the case.
HTML/PHP:
<div id="loader" class="loader" style="display: none">
<img width="35px" height="35px" src="{{ asset('img/ajax-loader.gif') }}" class="img-responsive center-block" alt="loader">
</div>
<div class="form-group">
<label for="cep">CEP:</label>
<input type="text" id="cep" name="cep" class="form-control important" value="{{ old('cep') }}">
</div>
Script:
$('#cep').on('blur', function(){
var f_empresa_nova = $('#f_empresa_nova').serializeArray();
var url = "/cep";
loader('on');
$.post(url, f_empresa_nova, function(data){
loader('off');
$('#logradouro').val(data.logradouro);
$('#bairro').val(data.bairro);
$('#cidade').val(data.cidade);
$('#uf').val(data.uf);
$('#cep').removeClass();
$('#cep').addClass("form-control required");
});
});
If the block-ui does not answer, put your code in jsfiddler that we do together this.
– RBoschini
What do you want to do? http://jsfiddle.net/k67Zk/
– RBoschini
You want the loading stay in the center and lock the screen until loading?
– Bia
That’s right @Bia
– Raylan Soares