Last active
May 25, 2023 08:52
-
-
Save mehmetsarr/ea52d3b65bee6fb811da4b96f841c3ed to your computer and use it in GitHub Desktop.
Codeigniter 4 Jquery Aynı Sayfada Post İşlemi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form role="form" id="form1" name="form1" method="post"> | |
<div class="form-group"> | |
<label><?= _("Başlık") ?> </label> | |
<input type="text" name="baslik" placeholder="Başlık" class="form-control"> | |
</div> | |
<div class="form-group"> | |
<label><?= _("Açıklama") ?> </label> | |
<textarea name="aciklama" placeholder="Açıklama"></textarea> | |
</div> | |
<button type="submit" name="button" id="button"><?= _("GÖNDER") ?></button> | |
</form> | |
<script> | |
$("#button").click(function(e) { | |
e.preventDefault(); | |
$.ajax({ | |
type: "POST", | |
url: "<?= base_url('post') ?>", | |
data: $("#form1").serialize() | |
}).done(function(data) { | |
alert("Form gönderildi."); | |
}); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment