Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

260
Visualizações
How to route API requests through certain IP address?

On a remote server, there is an HTML page with javascript. The user visits this page, makes some settings, and runs an API query.

How can I ensure that all API queries are routed independently from the user's location through a specific IP address, which is my proxy gateway? How is it possible with javascript?

This is the whole function that runs API query:

function Query(keyword)
{
    var qk = keyword;
    var queryresult = '';
    queryflag = true;


    $.ajax({
        url: window.location.protocol + "//apiv3.example.com/lookup",
        jsonp: "jsonp",
        dataType: "jsonp",
        data: {
        q: qk,
        client: "chrome",
        hl: document.querySelector("select").value
        },

        success: function(res) {
            var rL = res[1];

            var i = 0;
            for(i = 0; i < rL.length; i++)
            {
                var currents = CleanVal(rL[i]);
                if(hashMapResults[currents] != 1)
                {
                    hashMapResults[currents] = 1;
                    SaveLatest(CleanVal(rL[i]));

                    ktq[ktq.length] = currents;

                    var j = 0;
                    for(j = 0; j < 26; j++)
                    {
                        var chr = String.fromCharCode(97 + j);
                        var currentx = currents + ' ' + chr;
                        ktq[ktq.length] = currentx;
                        hashMapResults[currentx] = 1;
                    }
                }
            }
            FilterAndDisplay();
            var textarea = document.getElementById("input");
            textarea.scrollTop = textarea.scrollHeight;
            queryflag = false;
        }
    });
}
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You can't control routing between the user and the endpoint.

If you want data to go through your server then the URL you pass to $.ajax needs to be that of your server.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda