<script>
function gonder(){
$.ajax({
type: "POST",
url: "process.php",
data: $('#formm').serialize(),
error:function(){ $('#sonuc').html("Hata"); },
success: function(veri) { $('#sonuc').html(veri);}
});
}
</script>
Php Ajax Post |
5 Mesajlar | 1.151 Okunma |
<script>
function gonder(){
$.ajax({
type: "POST",
url: "process.php",
data: $('#formm').serialize(),
error:function(){ $('#sonuc').html("Hata"); },
success: function(veri) { $('#sonuc').html(veri);}
});
}
</script>
$kimdenval=$_POST['kimden'];
$tarihval=$_POST['tarih'];
$miktarval=$_POST['miktar'];
//insert,update vs işlemler.
function gonder() {
$.ajax({
type: "POST",
url: "process.php",
data: $('#formm').serialize(),
error: function(){$('#sonuc').html("Hata");},
success: function(veri) {$('#sonuc').html(veri);}
});
}
$kimdenval=$_POST['kimden'];
$tarihval=$_POST['tarih'];
$miktarval=$_POST['miktar'];
echo "Kimden:";
print_r($kimdenval);
echo "
Tarih:";
print_r($tarihval);
echo "
Miktar:";
print_r($miktarval);
?>
<script>
$(document).ready(function() {
$("form").submit(function() {
// Getting the form ID
var formID = $(this).attr('id');
var formDetails = $('#'+formID);
$.ajax({
type: "POST",
url: 'process.php',
data: formDetails.serialize(),
success: function (data) {
// Inserting html into the result div
$('#sonuc').html(data);
},
error: function(jqXHR, text, error){
// Displaying if there are any errors
$('#sonuc').html(error);
}
});
return false;
});
});
</script>