Das habe ich gemacht. Ich benutze MVC Codeigniter.Wie lade ich Daten aus der Datenbank mit Ajax?
$(document).ready(function(){
$.ajax({
type: 'post',
data: $("#attendance-pick").serialize(),
url: 'manageLogbook_controller/date_checker/'+ <?php echo $userid; ?>,
dataType: "json",
success: function(result) {
debugger;
$("#your_attendance").html(result);
}
});
});
und das Ergebnis sollte von sein.
CONTROLLER
function date_checker($userid){
How can i pass the result to success: function(result) on my View--->
$result['my_attendance'] = $this->ManageLogbook_model->retrieve_attendance($result);
}
MODEL
function retrieve_attendance($userid){
return $this->db->where('userid', $userid)
->get('attendance')
->result();
}
sollte ich diese Sir tun? $ ("# your_attendance") .html (Antwort); –
Ja, n ich bin nicht Sir: P –
funktioniert nicht, Erfolg: Funktion (Ergebnis) { var data = JSON.parse (Ergebnis); $ ("# Ihre_Anwesenheit").html (Daten); } Ich dachte über PHP für jede von (my_attendance) auf CONTROLLER $ result ['my_attendance'] = $ this-> ManageLogbook_model-> retrieve_attendance ($ result); –