これは機能しません
JS:
var currentPath = window.location.pathname;
var currentPage = currentPath.substring(currentPath.lastIndexOf('/')+ 1);
$(function(){
$( "#shoutBox")。submit(function(event){
event.preventDefault();
var values = $('#shoutBox')。serialize();
$ .post( "shoutbox.php"、values)
.done(function(data){
$('input:text [name = shout]')。val( "JE SHOUT IS GEPOST!WACHT 1 MINUUT!");
$('input:text [name = shout]')。attr('readonly'、true);
setTimeout(
働き()
{{
$('input:text [name = shout]')。val( "JE KAN EEN NIEUWE SHOUT MAKEN!");
$('input:text [name = shout]')。attr('readonly'、false);
}、60000);
});
});
});
$(function(){
$( "#newName")。submit(function(event){
event.preventDefault();
var valuen = $('#newName')。serialize();
$ .post( "shoutbox.php"、valuen)
.done(function(data){
reload();
});
});
});
関数to_new_page(リンク)
{{
$( "#content")。fadeOut(function()
{{
$(this).load(link + "#content"、function()
{{
$(this).fadeIn();
})
});
history.pushState({change: "page"}、 "RandomRadio"、 "/" + link);
}
関数reload()
{{
to_new_page(currentPage);
}
フォーム#shoutBoxは正常に機能します。
ただし、フォーム#newNameを2回送信すると、ページが更新されます。