Form button that display a google maps

Form button that display a google maps

Hello I would like to do a simple App that display a Button, after the click I would like to view a google maps with the track from my current position to a fix position.

I believe that the code is something like this:

  1. <html>
        <head>
            <meta charset="utf-8" />
            <meta name="viewport" content="width=device-width, initial-scale=1" />
            <meta name="apple-mobile-web-app-
    capable" content="yes" />
            <meta name="apple-mobile-web-app-status-bar-style" content="black" />
            <title></title>
            <link rel="stylesheet" href="css/my.css" type="text/css" />
            <script type="text/javascript" src="js/jquery-1.9.1.min.js" ></script>

           
            <script type="text/javascript" charset="utf-8" src="cordova-2.4.0.js"></script>
            <script type="text/javascript" charset="utf-8">
               




                // Wait for Cordova to load
                //

                document.addEventListener("deviceready", onDeviceReady, false);
               


                var watchID = null;
               
                // Cordova is ready
                //
                function onDeviceReady() {
                    // Throw an error if no update is received every 30 seconds
                    var options = { timeout: 30000 };
                    watchID = navigator.geolocation.getCurrentPosition(onSuccess, onError);
                   
                }
               
                // onError Callback receives a PositionError object
                //
                function onError(error) {
                    alert('code: '    + error.code    + '\n' +
                          'message: ' + error.message + '\n');
                }
                $('#button1').live("tap", function(){
                                  window.open('https://maps.google.com/maps?saddr='+position.coords.latitude+','+position.coords.longitude+'&daddr=45.404232,11.926511',  '_blank',  'location=no');
                                   })
                </script>
            <script type="text/javascript" src="js/jquery.mobile-1.3.0.min.js" ></script>
        </head>
        <body>
        .
        .
        .
    <FORM>
     <INPUT type="button" value="Carica la mappa" id="button1" />
     </FORM>






































In this case after the click, nothing happens. Now I do not think it's a problem of coordinates empty, but the syntax of the code.

Thanks

Paolo