if (isset($_POST['text'])) {
exit(str_split($_POST['text'])[1]);
}
?>
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
Document
<script></script>
<script>
function active(textarea) {
let buttons = $("button");
if (!textarea.value) {
buttons.prop("disabled", 1);
$("#bir, #iki").slideUp('fast')
}
else
buttons.prop("disabled", 0);
}
$(function() {
// Başarılı işlem
$("button:first-of-type").on("click", function() {
let data = $("textarea").val();
$.ajax({
url: window.location,
method: 'POST',
data: {text: data},
success: function(response) {
$("#bir").html(response).slideDown("fast");
$("#iki").html(response).slideUp("fast");
}
})
})
// Başarısız işlem
$("button:nth-of-type(2)").on("click", function() {
let data = $("textarea").val();
$.ajax({
url: 'api.php', // Olmayan bir adrese gönderelim
method: 'POST',
data: {txt: data},
success: function(response) {
$("#bir").html(response).slideDown("fast");
},
error: function (error) {
$("#iki").html(data).slideDown("fast");
$("#bir").html(data).slideUp("fast");
}
})
})
})
</script>