gpt4 book ai didi

jquery - Html 表单没有在 GET 上向 URL 添加参数

转载 作者:太空宇宙 更新时间:2023-11-03 23:44:19 25 4
gpt4 key购买 nike

我正在使用 groundworkcss 并创建了一个简单的 html 表单。但是当我提交表单时,结果 URL 只是“file://C://MyFiles//results.html?”

字段 txtName 的值未添加到 url。最小的非工作代码如下所示。

<html class="no-js"><!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
<title>Test &hearts; Test Information</title>
<!-- Modernizr -->
<script src="../js/libs/modernizr-2.6.2.min.js"></script>
<!-- jQuery-->
<script type="text/javascript" src="../js/libs/jquery-1.10.2.min.js"></script>
<!-- framework css --><!--[if gt IE 9]><!-->
<link type="text/css" rel="stylesheet" href="../css/groundwork.css"><!--<![endif]--><!--[if lte IE 9]>
<link type="text/css" rel="stylesheet" href="../css/groundwork-core.css">
<link type="text/css" rel="stylesheet" href="../css/groundwork-type.css">
<link type="text/css" rel="stylesheet" href="../css/groundwork-ui.css">
<link type="text/css" rel="stylesheet" href="../css/groundwork-anim.css">
<link type="text/css" rel="stylesheet" href="../css/groundwork-ie.css"><![endif]-->
<style type="text/css">
.logo {
position: relative;
top: -0.5em;
}
.logo a, .logo a:visited {
text-decoration: none;
color: #2B2B2D;
}
.logo img {
height: 2em;
position: relative;
top: 0.55em;
margin-right: 0.3em;
}

</style>
<!-- snippet (syntax highlighting for code examples)-->
<script type="text/javascript" src="../js/demo/jquery.snippet.min.js"></script>
<link type="text/css" rel="stylesheet" href="../css/demo/jquery.snippet.css"><script type="text/javascript">
(function() {

$(document).ready(function() {
$('pre[data-lang="html"]').snippet("html", {
style: "groundwork",
clipboard: "../js/demo/ZeroClipboard.swf"
});
$('pre[data-lang="css"]').snippet("css", {
style: "groundwork",
clipboard: "../js/demo/ZeroClipboard.swf"
});
$('pre[data-lang="sass"]').snippet("sass", {
style: "groundwork",
clipboard: "../js/demo/ZeroClipboard.swf"
});
return $('pre[data-lang="js"]').snippet("javascript", {
style: "groundwork",
clipboard: "../js/demo/ZeroClipboard.swf"
});
});

}).call(this);
</script>
</head>
<body>

<form action="results.html" method="get">
<fieldset>




<label for="name">Name </label>
<input id="txtNane" type="text" placeholder = "Enter your Name">

<br>
<hr>
<button id = "btnSubmit" type="submit"> Submit </button>

</fieldset></form>
<!-- javascript-->
<script type="text/javascript" src="../js/groundwork.all.js"></script>
<!-- google analytics-->

</body>
</html>

最佳答案

我认为你应该给它一个名称属性。例如:

<input id="txtNane" type="text" placeholder = "Enter your Name" name="input_name">

是这样的,因为它应该是这样的:

url.domain/page.php?input_name=input_value

同样在 PHP 中,您可以像这样访问它:

$_GET['input_name']

关于jquery - Html 表单没有在 GET 上向 URL 添加参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21958765/

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