Ver Mensaje Individual
  #1 (permalink)  
Antiguo 07/11/2011, 14:46
Avatar de mdk
mdk
 
Fecha de Ingreso: noviembre-2002
Mensajes: 531
Antigüedad: 21 años, 5 meses
Puntos: 11
Problema con Ajax

Alguien sabe cual es el problema, de porque al seleccionar un link, no me lo carga en el div correspondiente?

Código:
<html>
<head>
	<title>Primer script con jQuery</title>
<script src="../scripts/jquery.js" type="text/javascript"></script>	
<script language="javascript">
function Cargo(){
	$("#data a").click(function(){
		UpdateDiv(this.href, this.rel);
		return false;
	});
}
function UpdateDiv(Url, Capa){
	Capa = Capa||"data";
	$.ajax({
		type: 'get',
		url: Url,
		dataType: 'html',
		success: function(data){
			$("#"+Capa).html(data)
		}
	});
}
$(document).ready(Cargo);
</script>
</head>

<body>

<div id="data">
	<a href="http://www.google.com" rel="data2">Link 1</a><br />
	<a href="http://www.forosdelweb.com" rel="data2">Link 2</a><br />
    <a href="http://www.cuantocabron.com" rel="data2">Link 3</a>
</div>
 
<div id="data2" style="background-color: blue;">Aquí se mostrará el contenido</div>
__________________
SoY Lo Ke VeS iNKLuSo KuAnDo No Me VeS ;)