1
I want the button, after clicking to insert, to be locked. I can only insert once each button, which represents a task.
Knob:
<button class="btn btn-info" onclick="return confirm('Pretende registar esta atividade?');this.disabled=true;">Pequeno Almoço</button>
I’m trying with this.disabled=true;
but after clicking and entering in the database, it is in the same asset.
script on the page:
function myFunction() {
var today = new Date();
var date = today.getFullYear()+'-'+(today.getMonth()+1)+'-'+today.getDate();
var time = today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds();
var dateTime = date+' '+time;
document.getElementById("IniciarTarefa1").value = dateTime;
}
(function ($) {$(document).ready(function(e) {
$("#form,#form1").submit(function(e){
$.ajax({
type: "POST",
url: "./conexaoteste",
data: $("#form,#form1").serialize(), // serializes the form's elements.
dataType: "json",
success: function (data){
},
error: function(data){
$(".error_message").removeClass('hide'); // error message
},
});
});
});
When Voce speaks that it inserts into the database, how does Voce do it? Voce redirects?
– LocalHost
@Localhost do via
post
withajax
– Bruno
So instead of making $("#form,#Form1"). Submit(Function(e)); put in a function! you don’t need Ubmit, and on the button call this function or add an event to the button.
– brunox99x