2
When I make the request in some site vi ajax, takes the server IP as requesting, I have to put the user IP as the responsible for the request?
2
When I make the request in some site vi ajax, takes the server IP as requesting, I have to put the user IP as the responsible for the request?
0
Following example:
$('#enviar').click(function () {
$.ajax({
method: "GET",
url: "http://ip-api.com/json"
}).success(function (msg) {
$.ajax({
method: "POST",
url: "http://posttestserver.com/post.php",
data: {
ip: msg.query
}
}).success(function (e) {
$('#url')[0].innerHTML = e;
$('#ip')[0].innerHTML = msg.query;
alert('Salvo com sucesso.');
}).error(function (e) {
alert('Ocorreu um erro. Mensagem: ' + e);
});
}).error(function (msg) {
alert('Erro: ' + msg);
});
});
Ah understood.. But then in case, I would have to know how the requested page treats the IP? My request is Cross Domain..
No need because it is an API
Browser other questions tagged ajax request
You are not signed in. Login or sign up in order to post.
It will only take the server IP if you are making the request on the server side
– Rafael Telles
Use this API to send the user IP to the server: http://ip-api.com/
– Giancarlo Abel Giulian