mercredi 5 août 2015

Submit datepicker with ajax


i'm having issues with submiting my datepicker.

I use the code below to load my datepicker page and other 2 pages in the page i want.

in the below html i load 3 external pages and one of those is my datepicker. every time i submit the datepicker nothing happens.

if i don't load the page via ajax, when i click on submit the data is send successfully to the database.

What do i need to change in my javascript file so i can make this working.

Thanks

$(document).ready(function() {
    //initial
    $('#content').load('content/index.php');


    //handle menu click
    $('ul#nav li a').on('click', function() {
        var page = $(this).attr('href');
        //$('#content').load('content/'+ page +'.php');

        $.ajax({
            url: 'content/'+ page +'.php',
            context: document.body,
            success: function(response){
                $('#content').html(response);   
                console.log(response);      
            }
        });

        return false;
    });
});

<html>
    <head>
        <link rel="stylesheet" href="css/style.css" />
        <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">

        <script src="http://ift.tt/1E2nZQG"></script>
        <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
        <script src="js/general.js"></script>
    </head>
    <body>
        <div class="selector">
            <ul id="nav">
                <li><a href="index">Profil</a></li>
                <li><a href="planner">Planificare concediu</a></li>
                <li><a href="data">Usefull data</a></li>
                <li></li>
                <a href="logout.php">Logout</a>
            </ul>
            <div id="content"></div>    
        </div>

    </body>
<html>



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire