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
fetchdocs are pretty clear (IMO, anyway :) regarding parameters, as are the jQuery docs—it’s not clear what specifically you’re having a problem with.GETrequest, but it looks like the code you're trying is aPOSTrequest.