Ver Mensaje Individual
  #1 (permalink)  
Antiguo 14/12/2017, 07:57
dairo65
 
Fecha de Ingreso: abril-2011
Mensajes: 168
Antigüedad: 13 años
Puntos: 5
Busqueda hacer una función para actualizar

saludos.
tengo el código para guardar información pero no se como hacer una función para actualizar.


este es el código para guardar

Código Javascript:
Ver original
  1. function guardarLocalizacion(){
  2.     var http = new XMLHttpRequest();
  3.     var url = "guardar_php/guardar.php";
  4.     var params = "lat=" + document.getElementById('lat').innerText + "&lng=" + document.getElementById('lng').innerText;
  5.     http.open("POST", url, true);
  6.  
  7.     //Send the proper header information along with the request
  8.     http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  9.  
  10.     http.onreadystatechange = function() {//Call a function when the state changes.
  11.         if(http.readyState == 4 && http.status == 200) {
  12.             if(http.responseText != "-1"){
  13.                 alert("Localizacion guardada.");
  14.             }
  15.             else{
  16.                 alert("Se ha presentado un error guardando.")
  17.             }
  18.         }
  19.     }
  20.     http.send(params);
  21. }


alguna idea para este novato?

gracias