Hi I made this code which on submit clones the original data then if it is successful it will replace the html with some text telling them it was successful. then it will sort of reset the .Score-Update back to it's original content.
- $('.Score-Update form').submit(function () {
$.post('Modules/Cpanel/Scoreboard.mod.php', $(this).serializeArray(), function(data) {
var MyClone=$('.Score-Update').clone();
$('.Score-Update').html(data);
setTimeout(function() {
$('.Score-Update').replaceWith(MyClone);
},500);
});
return false;
});
So this works the first time round, If you submit the form it shows "Successful" then displays the original content. But if I was to try and submit it again this time instead of replacing the HTML content of <span class="Score-Update"></span> with the data it replaces the entire content of <div id="Content"></div>.
Hopefully someone can help me figure this out..