Why my button javascript doesnt work? is this bcause textarea?? or because I was too stupid and made some mistakes,,,
(when i click button, nothing hapen,,, data not save to db,, the error did not appear,,)
<script type="text/javascript">
$(document).ready(function() {
$("#save_data").click(function() {
var date = $('#datetimepicker1').val();
var sdlc = $('#sdlc').val();
$.ajax({
type: "POST",
url: "modul/update.php",
data: "date="+date+
"&sdlc="+sdlc,
success: function(data) {
alert('Berhasil di input');
window.location.href='p.php?p=uFA'
}
error: function(data) {
alert('gagal di input');
window.location.href='p.php?p=uFA'
}
});
});
});
</script>
this is my input form
<input id="datetimepicker1" type="text" value="<?php echo date('Y-m-d');?>" data-date-format="YYYY-MM-DD" class="input-sm" />
<textarea style=" resize: vertical;" id="sdlc" name="sdlc" rows="4" cols="70%" > </textarea>
<button class="btn btn-primary btn-rounded pull-right" id="save_data" name="save_data"><i class="fa fa-save"></i> save </button>
and this update.php
$date =$_POST['date'];
$sdlc =$_POST['sdlc'];
$input = "INSERT INTO table
(id,date,sdlc) VALUES('','$date','$sdlc')";
mysql_query($input);
thanks 4 everything