Load content of an url into a dialog doesn't work JQuery -
i have code: why not working? i've tried in several ways it's not working either. can me please? not feel capable find error in code.
<html> <head> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/jquery-ui.min.js"></script> <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/themes/humanity/jquery-ui.css" type="text/css" /> </head> <body> <div id="contingut"> </div> <a class="enllac_dialog" href="http://mon.uvic.cat/ajutcampus/category/configuracions/dispositius-mobils/ios/">ios</a> <a class="enllac_dialog" href="http://www.google.com">android</a>
function showdialog(enllac){ //load content , open dialog $("#contingut").load(enllac); $("#contingut").dialog("open"); } $("#contingut").dialog({ //create dialog, keep closed autoopen: false, height: 300, width: 350, modal: true }); $('.enllac_dialog').click(function(e){ e.preventdefault(); var enllac = $(this).attr("href"); console.log(enllac); showdialog(enllac); return false; }); </script> </body> </html>
href not work because when click on link open new window try like
<a class="enllac_dialog clickonce" value="http://www.google.com">android</a>
script
$('.enllac_dialog').click(function(e){ e.preventdefault(); var enllac = $(this).attr("value"); console.log(enllac); showdialog(enllac); return false; });
Comments
Post a Comment