How to send some parameters to a method with encodeURL, javascript?

0

Good day, I have the following variables that I must send as parameters to a method

var idPedido         = localStorage.getItem("IDPedido");
var tipo_envio       = localStorage.getItem("Tipo_Envio");

these variables are sent to the confirm function.

confirmar(idPedido, tipo_envio); //llamada de la funcion
    function confirmar(IDPedido, Tipo_Pedido) {
        return new Promise((res, rej) => {
            axios.get('https://URL/MetodoConfirmar?IDPedido=${IDPedido}&Tipo_Pedido=${Tipo_Pedido}', {
                headers: {
                    Authorization: token_type + " " + access_token
                }
            }).then(function (response) {
                console.log(response);
                myApp.hideIndicator();
                var dejar = true;
                switch (response.data.Cod_Respuesta) {
                    case "00":
                        console.log("Correcto");
                        break
                    case "02":
                    case "01":
                        dejar = false;
                        break;
                    default:
                        break;
                }
                myApp.hideIndicator();
                if (!dejar) {
                    myApp.alert("<strong>" + response.data.Cod_Mensaje + " Ingrese uno valido</strong>");
                }
                else {
                    myApp.hideIndicator();
                }
            }).catch(function (error) {
                console.log(error)
            })
        })
    }

It turns out that the method MetodoConfirmar should send the variables idPedido and tipo_envio using encodeURI , but I do not know how to do it in this method.

Thank you very much in advance.

    
asked by JG_GJ 24.10.2018 в 20:18
source

0 answers