gpt4 book ai didi

jquery - .submit 在 jquery mobile 中不起作用

转载 作者:行者123 更新时间:2023-12-01 06:10:19 25 4
gpt4 key购买 nike

<!-- jQuery / jQueryMobile Scripts -->
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.min.js"></script>
<script>
// Attach a submit handler to the form
$("#loginForm").submit(function (event) {

// Stop form from submitting normally
event.preventDefault();

// Get some values from elements on the page:
var $form = $(this),
username = $form.find("input[name='username']").val(),
password = $form.find("input[name='password']").val(),
url = $form.attr("action");

// Send the data using post
var posting = $.post(url, { username: username, password: password });

// Put the results in a div
posting.done(function (data) {
var content = $(data).find("#content");
$("#result").empty().append(content);
});
});

</script>



<div data-role="page" data-theme='b' id="1">
<div data-role="header" data-position="fixed" data-tap-toggle="false" data-theme='b'>
<a href="index.html" data-ajax="false"><i class='fa fa-bars'></i></a>
<h1>Glue Plus+</h1>
</div>



<div data-role="content">
<div class="inset">
<h1>Login</h1>
</div>
<form method="post" action="http://url/Sugar/php_Calls/login.php" id="loginForm" data-ajax="false">
<div data-role="fieldcontain">
<label for="name2b">Email:</label>
<input type="email" name="username" id="emailaddress" value="" data-clear-btn="true" placeholder="Type your email here...">
</div>

<div data-role="fieldcontain">
<label for="name2b">Password:</label>
<input type="password" name="password" id="password" value="" data-clear-btn="true" placeholder="Type your password here...">
</div>
<div data-role="fieldcontain">

<input type="checkbox" name="checkbox-1a" id="checkbox-1ab" checked="">
<label for="checkbox-1ab">Keep me logged in</label>

</div>
</form>

<button type="submit" id="btnlogin" name="login" href="#mainpage" data-inline="true">Submit</button>
</div>

</div>

当我通过 firebug 调试时,它不会出现在表单提交中

最佳答案

您的按钮超出了表单范围。您可以借助 form="loginForm" 解决此问题:

<button type="submit" form="loginForm" id="btnlogin" name="login" href="#mainpage" data-inline="true">Submit</button>

There are many questions like yours 。下次发帖前先搜索一下。

关于jquery - .submit 在 jquery mobile 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24325683/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com