Foros del Web » Programando para Internet » Javascript »

Ajax JQuery

Estas en el tema de Ajax JQuery en el foro de Javascript en Foros del Web. <html> <head> <title>Problema</title> <script src="uno.js" language="JavaScript"></script> <style type="text/css"> .voto { padding:0px; } .voto a { float:left; width:15px; text-decoration:none; text-align:center; color:#f00; background-color:#f7f8e8; border-right:1px solid white; font-size:13px; ...
  #1 (permalink)  
Antiguo 01/03/2013, 06:18
 
Fecha de Ingreso: septiembre-2010
Mensajes: 67
Antigüedad: 13 años, 7 meses
Puntos: 0
Ajax JQuery

<html>
<head>
<title>Problema</title>
<script src="uno.js" language="JavaScript"></script>
<style type="text/css">
.voto {
padding:0px;
}

.voto a {
float:left;
width:15px;
text-decoration:none;
text-align:center;
color:#f00;
background-color:#f7f8e8;
border-right:1px solid white;
font-size:13px;
}

.voto li {
display:inline;
}
</style>
</head>

<body>
<h1>Vote esta foto</h1>
<p>
<img src="http://www.forosdelweb.com/f13/foto1.jpg" alt="cuadro sobre geometria generativa">
</p>
<ul class="voto" id="votofoto1">
<li><a href="7.2.php?voto=1">1</a></li>
<li><a onclick="presionBoton()" href="7.2.php?voto=2">2</a></li>
<li><a onclick="presionBoton()" href="7.2.php?voto=3">3</a></li>
<li><a onclick="presionBoton()" href="7.2.php?voto=4">4</a></li>
<li><a onclick="presionBoton()" href="7.2.php?voto=5">5</a></li>
<li><a onclick="presionBoton()" href="7.2.php?voto=6">6</a></li>
<li><a onclick="presionBoton()" href="7.2.php?voto=7">7</a></li>
<li><a onclick="presionBoton()" href="7.2.php?voto=8">8</a></li>
<li><a onclick="presionBoton()" href="7.2.php?voto=9">9</a></li>
<li><a onclick="presionBoton()" href="7.2.php?voto=10">10</a></li>
</ul>
<br>
<div id="resultados"></div>
<a href="7.2.txt">Ver resultados</a>
</body>
</html>


--------------------

function presionBoton(e) {
var ref = window.event.srcElement;
var voto = ref.firstChild.nodeValue;
window.event.returnValue=false;

conexion1=crearXMLHttpRequest();
conexion1.open('GET', '7.2.php?voto='+voto, true);
conexion1.onreadystatechange = function() {
var resultados = document.getElementById("resultados");
if(conexion1.readyState == 4) {
resultados.innerHTML = 'Gracias.';
}
else {
resultados.innerHTML = 'Procesando...';
}
}
conexion1.send(null);
}


//***************************************
//Funciones comunes a todos los problemas
//***************************************
function crearXMLHttpRequest() {
var xmlHttp=null;
if (window.ActiveXObject)
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
else
if (window.XMLHttpRequest)
xmlHttp = new XMLHttpRequest();
return xmlHttp;
}
  #2 (permalink)  
Antiguo 01/03/2013, 06:21
 
Fecha de Ingreso: septiembre-2010
Mensajes: 67
Antigüedad: 13 años, 7 meses
Puntos: 0
Respuesta: Ajax JQuery

<html>
<head>
<script type="text/javascript">
function ajax(div, archivo) {
var http = false;
if(navigator.appName == "Microsoft Internet Explorer") {
http = new ActiveXObject("Microsoft.XMLHTTP");
}
else {
http = new XMLHttpRequest();
}
http.open("GET", archivo, true);
http.onreadystatechange=function() {
if(http.readyState == 4) {
document.getElementById(div).innerHTML = http.responseText;
}
}
http.send(null);
}
</script>
</head>>

<body>
<b><span id="elspan">Aqu� meter� el resultado de Ajax</span></b>
<br><br>
<span onclick="ajax('elspan', '7.3-1.html');">Hazme Click</span>
<br><br>
<span onclick="ajax('elspan', '7.3-2.html');">Hazme Click</span>
</body>
</html>


------------------------------------------------------
  #3 (permalink)  
Antiguo 01/03/2013, 06:22
 
Fecha de Ingreso: septiembre-2010
Mensajes: 67
Antigüedad: 13 años, 7 meses
Puntos: 0
Respuesta: Ajax JQuery

Cita:
Iniciado por soymari Ver Mensaje
<html>
<head>
<title>Problema</title>
<script src="uno.js" language="JavaScript"></script>
<style type="text/css">
.voto {
padding:0px;
}

.voto a {
float:left;
width:15px;
text-decoration:none;
text-align:center;
color:#f00;
background-color:#f7f8e8;
border-right:1px solid white;
font-size:13px;
}

.voto li {
display:inline;
}
</style>
</head>

<body>
<h1>Vote esta foto</h1>
<p>
<img src="http://www.forosdelweb.com/f13/foto1.jpg" alt="cuadro sobre geometria generativa">
</p>
<ul class="voto" id="votofoto1">
<li><a href="7.2.php?voto=1">1</a></li>
<li><a onclick="presionBoton()" href="7.2.php?voto=2">2</a></li>
<li><a onclick="presionBoton()" href="7.2.php?voto=3">3</a></li>
<li><a onclick="presionBoton()" href="7.2.php?voto=4">4</a></li>
<li><a onclick="presionBoton()" href="7.2.php?voto=5">5</a></li>
<li><a onclick="presionBoton()" href="7.2.php?voto=6">6</a></li>
<li><a onclick="presionBoton()" href="7.2.php?voto=7">7</a></li>
<li><a onclick="presionBoton()" href="7.2.php?voto=8">8</a></li>
<li><a onclick="presionBoton()" href="7.2.php?voto=9">9</a></li>
<li><a onclick="presionBoton()" href="7.2.php?voto=10">10</a></li>
</ul>
<br>
<div id="resultados"></div>
<a href="7.2.txt">Ver resultados</a>
</body>
</html>


--------------------

function presionBoton(e) {
var ref = window.event.srcElement;
var voto = ref.firstChild.nodeValue;
window.event.returnValue=false;

conexion1=crearXMLHttpRequest();
conexion1.open('GET', '7.2.php?voto='+voto, true);
conexion1.onreadystatechange = function() {
var resultados = document.getElementById("resultados");
if(conexion1.readyState == 4) {
resultados.innerHTML = 'Gracias.';
}
else {
resultados.innerHTML = 'Procesando...';
}
}
conexion1.send(null);
}


//***************************************
//Funciones comunes a todos los problemas
//***************************************
function crearXMLHttpRequest() {
var xmlHttp=null;
if (window.ActiveXObject)
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
else
if (window.XMLHttpRequest)
xmlHttp = new XMLHttpRequest();
return xmlHttp;
}
-----------------------
<?php
header('Content-Type: text/html; charset=ISO-8859-1');
$ar=fopen("7.2.txt","a") or die("No se pudo abrir el archivo");
fputs($ar,$_REQUEST['voto']."-\n");
fclose($ar);
?>
  #4 (permalink)  
Antiguo 01/03/2013, 08:54
 
Fecha de Ingreso: enero-2012
Ubicación: Santiago de Surco, Lima - Perú
Mensajes: 266
Antigüedad: 12 años, 3 meses
Puntos: 57
Respuesta: Ajax JQuery

Hola soymari, que tal.

No veo código JQuery, solo es javascript y ajax.

Que hay con el código que haz compartido? No haz expuesto alguna duda o interrogante.

Que fin tiene este tema?
  #5 (permalink)  
Antiguo 01/03/2013, 17:33
Avatar de Reedyseth  
Fecha de Ingreso: enero-2009
Ubicación: Chihuahua, México
Mensajes: 419
Antigüedad: 15 años, 3 meses
Puntos: 36
Respuesta: Ajax JQuery

Eso parece Spam :p !!
__________________
Reedyseth
Te ayudo? No olvides dar un +
blog:http://behstant.com/blog
En el blog:Tutoriales de Desarrollo Web PHP, Javascript, BD y más.
  #6 (permalink)  
Antiguo 01/03/2013, 22:49
Avatar de emprear
Colaborador
 
Fecha de Ingreso: junio-2007
Ubicación: me mudé
Mensajes: 8.388
Antigüedad: 16 años, 10 meses
Puntos: 1567
Respuesta: Ajax JQuery

Ni jQuery, ni enunciado?
Para mi que aún no se repuso de esto
http://www.forosdelweb.com/f45/recup...-bbdd-1038570/

Saludos
__________________
La voz de las antenas va, sustituyendo a Dios.
Cuando finalice la mutación, nueva edad media habrá
S.R.
  #7 (permalink)  
Antiguo 02/03/2013, 00:58
 
Fecha de Ingreso: enero-2012
Ubicación: Santiago de Surco, Lima - Perú
Mensajes: 266
Antigüedad: 12 años, 3 meses
Puntos: 57
Información Respuesta: Ajax JQuery

emprear, no se porque me parece que soymari usó este tema para tener disponible (online) este código, para otro examen.

Etiquetas: ajax, jquery
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 19:52.