Javascript setTimeout表单数据(Javascript setTimeout form data)
我有一个HTML格式:
<form method="post" action="login-autentica" id="loginform" class="input-wrapper blue-gradient glossy" title="Login"> <ul class="inputs black-input large"> <li><span class="icon-user mid-margin-right"></span> <input type="text" name="porta" id="username" value="" class="input-unstyled" placeholder="Porta" autocomplete="off"> </li> <li><span class="icon-lock mid-margin-right"></span> <input type="password" name="senha" id="password" value="" class="input-unstyled" placeholder="Senha" autocomplete="off"> </li> </ul> <p class="button-height"> <button type="submit" class="button glossy float-right" id="login">Entrar</button> <input type="checkbox" name="remind" id="remind" value="1" checked="checked" class="switch tiny mid-margin-right with-tooltip" title="Habilitar Auto-Login"> <label for="remind">Lembrar</label> </p> </form>
JavaScript负责错误消息和其他事情:
$('#loginform').submit(function (event) { // Values var login = $.trim($('#username').val()), pass = $.trim($('#password').val()); // Check inputs if (login.length === 0) { // Display message displayError('Por Favor, insira sua porta!'); return false; } else if (pass.length === 0) { // Remove empty login message if displayed formWrapper.clearMessages('Por Favor, insira sua porta!'); // Display message displayError('Por Favor, insira sua senha!'); return false; } else { // Remove previous messages formWrapper.clearMessages(); // Show progress displayLoading('Checando usuário CasCast...'); // Stop normal behavior event.preventDefault(); // Simulate server-side check setTimeout(function () { document.location.href = 'url' }, 2000); } });
问题出现在以下声明中:
"setTimeout (function () {document.location.href = 'url'}, 2000);"
我的表单html将数据发送到名为
'login-autentica.php'
的php文件,这个问题是setTimeout
无法将数据发送到PHP,返回错误。我希望当用户单击
'submit'
,HTML表单中的数据将被捕获并在setTimeout()
提到的时间段之后发送到“login-autentica.php”,?谢谢你的帮助,原谅我的英语,我来自巴西......
I have an html form:
<form method="post" action="login-autentica" id="loginform" class="input-wrapper blue-gradient glossy" title="Login"> <ul class="inputs black-input large"> <li><span class="icon-user mid-margin-right"></span> <input type="text" name="porta" id="username" value="" class="input-unstyled" placeholder="Porta" autocomplete="off"> </li> <li><span class="icon-lock mid-margin-right"></span> <input type="password" name="senha" id="password" value="" class="input-unstyled" placeholder="Senha" autocomplete="off"> </li> </ul> <p class="button-height"> <button type="submit" class="button glossy float-right" id="login">Entrar</button> <input type="checkbox" name="remind" id="remind" value="1" checked="checked" class="switch tiny mid-margin-right with-tooltip" title="Habilitar Auto-Login"> <label for="remind">Lembrar</label> </p> </form>
JavaScript is responsible for error messages and other things:
$('#loginform').submit(function (event) { // Values var login = $.trim($('#username').val()), pass = $.trim($('#password').val()); // Check inputs if (login.length === 0) { // Display message displayError('Por Favor, insira sua porta!'); return false; } else if (pass.length === 0) { // Remove empty login message if displayed formWrapper.clearMessages('Por Favor, insira sua porta!'); // Display message displayError('Por Favor, insira sua senha!'); return false; } else { // Remove previous messages formWrapper.clearMessages(); // Show progress displayLoading('Checando usuário CasCast...'); // Stop normal behavior event.preventDefault(); // Simulate server-side check setTimeout(function () { document.location.href = 'url' }, 2000); } });
The problem is in the following statement:
"setTimeout (function () {document.location.href = 'url'}, 2000);"
My form html sends data to a php file called
'login-autentica.php'
, The problem with this is thatsetTimeout
can not send the data to PHP, returning the error.I want that when the User click
'submit'
, data from HTML form to be captured and sent to the 'login-autentica.php' after the time-period mentioned insetTimeout()
,?Thanks for helping me, excuse my english, I'm from Brazil...
原文:https://stackoverflow.com/questions/20828317
最满意答案
使用char_length()字符串函数。
SELECT * FROM table WHERE char_length(description)> 100
在此处查看更多信息http://dev.mysql.com/doc/refman/5.0/zh/string-functions.html#function_char-length
Use the char_length() string function.
SELECT * FROM table WHERE char_length(description) > 100
Check out more information here http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_char-length
相关问答
更多-
使用%in%过滤行?(Filter rows using %in%?)[2022-06-01]
你能测试一下这项工作吗: library(dplyr) # Modify entries data$NameMod <- tolower(gsub(" .*", "", data$Name)) data$StrMod <- tolower(data$Street) dnc$`Last Name` <- tolower(dnc$`Last Name`) dnc$`Street Name` <- tolower(dnc$`Street Name`) # Filter data using dplyr fi ... -
过滤/子集/删除包含R中字符串中间字符的行(filter/subset/delete rows that contain character in middle of string in R)[2023-08-31]
这里是dplyr解决方案: str_locate是与grepl等价的grepl ,所以代码如下所示: df2 <- df1 %>% filter(Peptide %>% str_detect("^.[^RK]*.$")) Here's the dplyr solution: str_locate is the tidyverse equivalent to grepl, so the code looks like this: df2 <- df1 %>% filter(Peptide %>% s ... -
语法是.*j.* selected = filter scomp by ($1 matches '.*j.*'); 用于不区分大小写的匹配 selected = filter scomp by ($1 matches '(?i).*j.*'); The syntax is .*j.* selected = filter scomp by ($1 matches '.*j.*'); For case insensitive matches selected = filter scomp by ($1 m ...
-
您可以直接使用F表达式过滤相关模型中的字段。 像这样的东西应该工作: from django.db.models import F # This will return all messages where one of the associated users # was created_at before the message edit_date. Message.objects.filter( edit_date__gte=F('users__created_at') ).distinct ...
-
如果你特别需要len ,那么@ MaxU的回答是最好的。 对于更通用的解决方案,您可以使用Series的映射方法。 df[df['amp'].map(len) == 495] 这将对每个元素应用len ,这就是你想要的。 使用这种方法,您可以使用任何函数,而不仅仅是len 。 If you specifically need len, then @MaxU's answer is best. For a more general solution, you can use the map method o ...
-
使用char_length()字符串函数。 SELECT * FROM table WHERE char_length(description)> 100 在此处查看更多信息http://dev.mysql.com/doc/refman/5.0/zh/string-functions.html#function_char-length Use the char_length() string function. SELECT * FROM table WHERE char_length(descriptio ...
-
如果基于列A In [865]: df[~(df.A.str.len() > 10)] Out[865]: A B 0 1 2 1 NaN 1 如果基于所有列 In [866]: df[~df.applymap(lambda x: len(str(x)) > 10).any(axis=1)] Out[866]: A B 0 1 2 1 NaN 1 If based on column A In [865]: df[~(df.A.str.len() > 10 ...
-
您需要考虑到某些文档可能具有空title字段。 所以你可以使用groovy null-safe运算符。 另外请确保使用POST方法: POST books/_search { "filter" : { "script" : { "script" : "_source.title?.size() > 10" } } } You need to take into account that some documents m ...
-
在字符串周围使用双引号。 =SUM(FILTER(B1:B4,A1:A4="Lorem")) 替代方式将是...... =SUMIF(A1:A4, "Lorem", B1:B4) 要么 =SUMPRODUCT(A1:A4="Lorem", B1:B4) Use double quotes around the string. =SUM(FILTER(B1:B4,A1:A4="Lorem")) Alternative ways would be.. =SUMIF(A1:A4, "Lorem", B1: ...
-
SQL仅根据另一个字段的值过滤字段的某些值(SQL Filter only some values of a field based on value of another field)[2024-04-04]
好的,编辑后这似乎很接近,但也返回NULL 25 : WHERE NOT (ordernumber IS NULL AND price IN (35, 40)) Ok, after your edit this seems to be close, but also returns NULL 25: WHERE NOT (ordernumber IS NULL AND price IN (35, 40))