ayuda porfavor
Publicado por babu (1 intervención) el 06/02/2014 21:54:03
estoy usando xampp y no se por que no me funciona es to jquery con ajax me por favor alguien es capaz de decifrar este quebradero de cabeza =( se supone que me tiene que sumar uno o error pero no impor ta que ponga simpre me sale 1 de respuesta o_O!!
nombre del archivo: ajaxcompleto.html
..........................................................................................................
nombre del archivo; ajaxcompleto2.php
nombre del archivo: ajaxcompleto.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<!Doctype html>
<html>
<meta charset= "utf-8"
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
var x;
x=$(document);
x.ready(inicio);
function inicio() {
var x;
x=$("#enviar");
x.click(enviar);
}
function enviar() {
var v=$("#numero").attr("value");
$.ajax({
asymc:true,
type:"POST",
dataType:"html",
contentType:"application/x-www-form-urlencoded",
url:"ajaxcompleto2.php",
data:"anio="+v,
beforeSend:inicioEnvio,
success:llegada,
timeout:8000,
error:problemas
});
return false;
}
function inicioEnvio(){
var x=$("#resultados");
x.html('Cargando...');
}
function llegada(datos) {
$('#resultados').text(datos);
}
function problemas(){
$("#resultados").text('problemas en el servidor.');
}
</script>
<style type="text/css">
</style>
</head>
<body>
Dime que anyo es este
<input type="text" name="anio" id="numero" >
<input type="submit" value="Y te digo Cual es el servidor" id="enviar">
<div id="resultados"></div>
</body>
<html>
..........................................................................................................
nombre del archivo; ajaxcompleto2.php
1
2
3
<?php
echo $_POST['anio']+1;
?>
Valora esta pregunta


0