How to add one diagonal after another, in an automated way?

1

What I would like to do is to be able to add a double diagonal every time there is a simple diagonal within my url that I get since my original purpose is to save the address of an image in my database but it only saves one point And not all the direction and my point of view is due to the simple diagonal, although I'm not sure.

.js code that initialize the storage of the image and get the address of that route.

guardarImagenP();
    var logo = $("#txtLogoP").text();

Code to save image:

/* Función para gurdar archivos */
function guardarImagenP() {
    $("#updLogoP").uploadify({
        'swf': '../../../js/system/uploadify/uploadify.swf',
        'uploader': 'subirImagen.ashx',
        'cancelImg': '../../../js/system/uploadify/cancel.png', /// "../../system/uploadify/uploadify.swf"
        'folder': 'bom',
        'auto': true,
        'multi': false,
        'queueSizeLimit': 1,
        'uploadLimit': 1000,
        'fileTypeDesc': 'Archivos jpg', //<-- This can be whatever you want
        'fileTypeExt': '*.jpeg',
        'buttonText': "Seleccionar",
        'onUploadSuccess': function (file, XMLHttpRequest) {
            var ruta = XMLHttpRequest;
            if (XMLHttpRequest != -1) {
                $("#txtLogoP").text(ruta);
                $("#imgLogoP").attr("src", ruta);
            } else {
                alert(XMLHttpRequest)
            }
        }
    });
}
    
asked by David 13.02.2017 в 19:14
source

1 answer

2

To add a / (diagonal) after another, automatically use Regular Expressions Because it is a special character, you must escape it by prefixing \ , that is, you must use \/ . You must also use the parameter g , global search.

Example

var URL = "http://es.stackoverflow.com/tags";
var re = /\//g;
var resultado = URL.replace(re,'//');
console.log(resultado);
    
answered by 13.02.2017 / 19:29
source