Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

174
Vistas
How can I make a POST request in react native

So I created a website where I used JS and jQuery to send data to a server. But now I am making that website as an app on my phone using react native. I've read about the fetch function but I don't completely understand how I would go about it to make this request. This is the code I used on my website:

$(".btn").click(function() {
    var p = $(this).attr('id');
    pin: p
    $.get("http://192.168.0.129:80/", {
    pin: p
    });
    DisableButtons();
});

Right now I have the following:

sendData = (data) => {
    console.log(data);
    var p = data;
    pin: p
    $.get("http://192.168.0.129:80/", {   --> this needs to be changed so it could work 
    pin: p                                    in react native 
    }); 
  }

So what I want to accomplish is to send this url when I call the function: http://192.168.0.129/?pin=xxx

Thanks in advance

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

A typical fetch request in javascript looks like this.

const sendData = async(data) => {
    const response = await fetch(`http://192.168.0.129:80/?pin=${p}`).then(res => res.json()) //or res.text() if you are expecting text response.
    console.log('results')

}

https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch

about 4 years ago · Juan Pablo Isaza Denunciar

0

So I got the solution, it was simpler then I thought:

sendData = (data) => {
    console.log(data);
    var url = `http://192.168.0.129:80/?pin=${data}`;
    fetch(url);
  }
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda