0

I HAVE THIS CODE: WHY IT IS NOT WORKING? I've tried it in several ways but it's not working either. Can someone help me please? I do not feel capable to find the error in this 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 and open dialog
        $("#contingut").load(enllac);
        $("#contingut").dialog("open");         
    }


    $("#contingut").dialog({  //create dialog, but keep it 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>
Anna
  • 126
  • 1
  • 1
  • 10
  • see the log. maybe you get error "No 'Access-Control-Allow-Origin' header is present on the requested resource." if the reason is that error look this: http://stackoverflow.com/questions/10636611/how-does-access-control-allow-origin-header-work – Ararat Harutyunyan Oct 15 '15 at 09:07
  • Thank you @AraratHarutyunyan , I've created a php file and added this code into my HTML, but it's not working either: function showDialog(enllac){ //load content and open dialog $("#contingut").load("phpdialog.php", ); $("#contingut").dialog("open"); } My php file is called phpdialog.php and contains this code: – Anna Oct 16 '15 at 08:31

1 Answers1

-1

href will not work because when you click on link it will open new window so 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;

        });
Vishnu Katpure
  • 293
  • 3
  • 15