Ver Mensaje Individual
  #6 (permalink)  
Antiguo 04/11/2009, 14:03
bebo
 
Fecha de Ingreso: octubre-2009
Mensajes: 97
Antigüedad: 14 años, 6 meses
Puntos: 4
Respuesta: Ayuda: Función en AJAX

Copia EXACTAMENTE esto:

pagina.html:
Código:
<html><title>Tu titutlo</title><body>Tu contenido.....
<script language=javascript>function eliminar(elid){
if(confirm("¿Esta seguro de continuar")){
var sitio_web="pon aqui la ruta completa del archivo eliminar.php (virtual) ";
if(confirm('¿Está seguro de ocntinuar?')){
var ajax=new ActiveXObject('msxml2.XMLHTTP');
ajax.open('POST',sitio_web,false);
ajax.send('elid='+elid);
alert(ajax.ResponseText);
location.reload()}else{
alert('Ha elegido no borrar nada')}
}</script>
<a onclick="eliminar('aqui pon el id del artista');return false" href='#'>Eliminar</a>
</body></html>
y en eliminar.php:
Código:
<?php
$resultado = mysql_query("DELETE FROM id_artista WHERE ArtistaId=".$_POST['elid']);
echo 'Se ha borrado lo indicado. Al hacer clic en Aceptar, se actualizara la pagina.'
?>
A mi también se me hace raro que todavía no funcione.
Estoy seguro de que esta vez funciona.