How can I change this function so when I submit form the button disables and page refreshes ?
function thanks() {
setTimeout(function () {
document.location.pathname = "index.php";
}, 3000);
}
Page refresh function is working btw. I just need to disable button.
This is my form
<form method="post" action="<?=htmlspecialchars($_SERVER["PHP_SELF"], ENT_QUOTES, "utf-8");?>?id={{$theme->id}}" id="myForm">
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<input type="hidden" name="price" value="{{$theme->price}}">
<input type="hidden" name="id" value="{{$theme->id}}">
<button type="submit" class="btn btn-success" onclick="thanks()"><span class="glyphicon glyphicon-shopping-cart"></span>Buy theme</button>
</form>
EDIT
Problem is that whenever I disable the button the file doesn't start downloading.. why ?