javascript - Automatically Enable Submit button at particular time from server using PHP JS -
what i'm looking this. have simple php page submit button disabled default. want submit button enabled @ particular time example 02:00:00
with php can time server date("h:i:s")
using in js variable. var time = "<? php echo date("h:i:s") ; ?>" ;
now using setinterval() method every millisec trying compare value of "time" variable particular time want button enabled. if(time=="02:00:00") { button.disabled=false; }
but problem "time" variable should dynamically change meet conditions otherwise nothing happen.i can't simple solution.do require ajax this?
any appreciated :) thanx!
i update time
variable using javascript:
var curtime = new date(); var firstcolon = curtime.tostring().indexof(":"); time = curtime.tostring().substring(firstcolon-2, firstcolon+6)
i'm python person, think php servers work in when going link, request sent, , data sent back, possibly dynamically created webpage python code, webpage can't contain python or php. languages strictly server-side. send request server time, inefficient , it's better client side dynamically change webpage requests php server.
since disabling button, if button sends request server, remember check time right server-side in case tampered webpage using javascript console client-side.
Comments
Post a Comment