vendredi 22 janvier 2021

I am Getting issue of CORS while calling google places api in AJAX laravel 5.4

$.ajax({ type: 'GET', url: 'https://ift.tt/3iLrMOU datainput1 +'&key=apikey

$(document).ready(function () {
            $("#autocomplete_text_1").keyup(function(){
                var datainput = $("#autocomplete_text_1").val();
                $.ajax({
                    type: 'GET',
                    url: 'https://maps.googleapis.com/maps/api/place/autocomplete/json?input='+ datainput +'&key=apikey',
                    dataType: 'json',
                    success:function(data){
                       // console.log(data.predictions);
                        var autocomplete_text_1_from = [];
                        $.each(data.predictions, function(key, value) {
                         //   console.log(value.description);
                            autocomplete_text_1_from.push("<li onclick='getfromride(\""+value.description+"\")'>"+ value.description +"</li>");
                        });
                        $('#autocomplete_text_from_1').html(autocomplete_text_1_from.join(' ').trim());
                    }
                });
            });
            });

', dataType: 'json', success:function(data){ console.log(data); } });



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire