Good afternoon, I need a help, I have this request get from ajax that sends to the web service, and I need to put this variable id, in the url, because inside the webservice I get this variable and I treat the return, correct ? I do not know how to do this, but I'm not sure how to do this, but I'm not sure how to do this. / users-update / 55 / update "> link " so I can get the return as 55, what do I need to do to get the variable recognized? Thank you.
$(document).ready(function(){
var id;
$.getJSON('http://localhost/projetohtml/admin/users-list-all',function(data){
$.each(data, function(k, v){
id = v.iduser;
console.log(id);
});
});
$.ajax({
url: "http://localhost/projetohtml/admin/users-update/"+id+"/update",
method: 'GET',
data: JSON,
success: function ( response ) {
console.log(response);
console.log(id);
$.each(JSON.parse(response), function(k, v){
$("#desperson").attr("value",v.desperson);
$("#deslogin").attr("value",v.deslogin);
$("#nrphone").attr("value",v.nrphone);
$("#desemail").attr("value",v.desemail);
$("#inadmin").attr("value",v.inadmin);
});
/*window.location.replace("http://localhost/projetohtml/admin/users/users-update")*/
},
error: function () {
}
});