Hey guys, I'm working on a "status"-Updater. It works, there is just one problem, after sending a Status I have to manual reload the page to let the script work again. Do you can help me please? Here's the code:
<script language="javascript">
$(document).ready(function(){
$("form#status_form").submit(function(){
var s_autor = $('#s_autor').attr('value');
var s_status = $('#s_status').attr('value');
$.ajax({
type: "POST",
url: "/admin/request.php",
data: "s_autor="+ s_autor +"& s_status="+ s_status,
success: function(){
$('#show').load("/admin/request.php").fadeIn("slow", function(){
setTimeout(function(){
$(function() {
$("#show").fadeTo("slow", 0.01, function(){
$(this).slideUp("slow", function() {
$(this).remove();
});
});
});
}, 2000);
});
},
});
return false;
});
});
</script>
So do you know how to code it to make it possible to repeat the script how often I click on the submit button?
By the way, here's the HTML-Form:
<form id="status_form" method="post" action="request.php" onsubmit="return false;">
<input type="text" id="s_autor" name="s_autor" value="<?= $user_id; ?>" style="display: none;" /><input type="text" id="s_status" name="s_status" value="Statusnachricht" /><input type="submit" value="" class="submit" id="status_submit" />
</form>