Slash "/" and blank space in JavaScript function parameters

0

Ineedtopassastringcontainingbarsandwhitespace.

<ahref="javascript:carregaCliente('184/5 RB')"></a>

And in function

function carregaCliente(reg){

        console.log(reg);

        var map;

        $('#modalMapa').modal('show').on('shown.bs.modal', function () {
            map = new GMaps({
                div: '#map',
                center:{
                    lat: latitude,
                    lng: longitude
                },
                zoom: 17,
                scrollwheel: false,
                mapTypeId: google.maps.MapTypeId.ROADMAP,
                mapTypeControlOptions: {
                    style: google.maps.MapTypeControlStyle.DROPDOWN_MENU,
                    position: google.maps.ControlPosition.TOP_RIGHT
                },
                styles: [{
                    "featureType": "poi",
                    "stylers": [
                    { "visibility": "off" }]
                }]
            });

            map.addMarker({
                lat: latitude,
                lng: longitude,
                infoWindow: {
                    content: '<div style="padding-top:8px;color:#333;"><p>Cod Cliente: '+reg+'</p></div>'                   
                },
                animation: google.maps.Animation.DROP,
            }); 
            var markerInstance = map.markers[0];
            markerInstance.infoWindow.open(map, markerInstance);
        });         
    };

It simply does not load the page. the same happens if I put a date eg: 10/01/2016 14:00:50

    
asked by anonymous 22.02.2017 / 17:41

1 answer

0

Whitespace as parameters are problematic. Try to replace the whitespace with its UTF-8 equivalent: \ u0020

    
11.04.2018 / 14:56