2010-05-18 3 views
0

일정 목록을 프로그래밍 중이며 대화 상자 (jQuery UI 모달 양식 사용)에서 양식을 열고 데이터베이스에 정보를 등록하려고하지만 ' 내가하고 싶은 일의 예를 찾지 마라.jQuery UI 대화 상자 및 데이터베이스가있는 간단한 양식

일부 코드를 수집했지만 작동하지 않습니다. 실수가 있다는 것을 알고 있지만 jQuery와 그 모든 것들을 처음 사용하기 때문에 수정할 수 없습니다.

여기에 내 코드

$(function() { 
    $("#dialog").dialog("destroy"); 

    var libelle = $("#libelle"), 
    type = $("#type"), 
    employe = $("#employe"), 
    date = $("#date"), 
    client = $("#client"), 
    camion = $("#camion"), 
    commentaire = $("#commentaire"), 
    allFields = $([]).add(libelle).add(type).add(employe).add(date).add(client).add(camion).add(commentaire); 

    $("#dialog-form").dialog({ 
    autoOpen: false, 
    height: 450, 
    width: 250, 
    modal: false, 
    buttons: { 
    'Ajouter une tache': function() { 
    $(".ajax").submit(function(e) { 
     var datas = $(this).serialize();   
     $.ajax({ 
     type: 'POST',  
     url: traitement.php,  
     data: datas,  
     success: function(data) { 

     } 
     }); 
    }); 
    $(this).dialog('close'); 
    }, 
    Retour: function() { 
    $(this).dialog('close'); 
    } 
    }, 
    close: function() { 
    allFields.val('').removeClass('ui-state-error'); 
    } 
    }); 



    $('#create-user') 
    .button() 
    .click(function() { 
    $('#dialog-form').dialog('open'); 
    }); 

}); 

과 HTML

<div class="test"> 


<div id="dialog-form" title="Ajouter une tache"> 
    <form> 
    <fieldset> 
    <label for="libelle">Libelle</label> 
    <input type="text" name="libelle" id="libelle" class="text ui-widget-content ui-corner-all" /> 

    <label for="Type">Type de RDV</label> 
    <select name="type" id="type" class="text ui-widget-content ui-corner-all" /> 
    <option value="Entretien">Entretien</option> 
    <option value="Dépannage">Dépannage</option> 
    <option value="Congés">Congés</option> 
    </select> 

    <label for="employe">Employe</label> 
    <select name="id_empl" id="id_empl" class="selectbox ui-widget-content ui-corner-all" /> 
    <option value="Entretien">Entretien</option> 
    <option value="Dépannage">Dépannage</option> 
    <option value="Congés">Congés</option> 
    </select> 

    <label for="date">Date</label> 
    <input type="text" name="date" id="date" class="text datepicker ui-widget-content ui-corner-all" /> 


    <label for="client">Client</label> 
    <input type="text" name="client" id="client" class="text ui-widget-content ui-corner-all" /> 

    <label for="camion">Réservation Camion</label> 
    <input type="checkbox" name="camion" id="camion" class="text ui-widget-content ui-corner-all" /> 

    <label for="commentaire">Commentaire</label> 
    <textarea name="commentaire" cols="30" rows="5" class="text ui-widget-content ui-corner-all"></textarea> 
    </fieldset> 
    </form> 
</div> 

<button id="create-user">Ajouter une tache</button> 

</div> 

답변