Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
can';t使用jquery序列化表单。serialize_Jquery_Html - Fatal编程技术网

can';t使用jquery序列化表单。serialize

can';t使用jquery序列化表单。serialize,jquery,html,Jquery,Html,我很努力-我一定错过了一些明显的东西,但我检查了格式错误的html,javascript尝试通过firebug进行调试,选择不同的方式,但没有任何效果。为什么我不能序列化我的表单??我的代码如下: <!DOCTYPE html> <html> <head> <link rel="stylesheet" type="text/css" href="http://ajax.microsoft.com/ajax/jquery.ui/1.8.6/themes/l

我很努力-我一定错过了一些明显的东西,但我检查了格式错误的html,javascript尝试通过firebug进行调试,选择不同的方式,但没有任何效果。为什么我不能序列化我的表单??我的代码如下:

<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="http://ajax.microsoft.com/ajax/jquery.ui/1.8.6/themes/le-frog/jquery-ui.css" />
<link rel="stylesheet" type="text/css" href="./application/css/main.css" />
<link rel="stylesheet" type="text/css" href="./application/css/uniform.default.css" />
</head>
<body>
<div id="markerinfocontainer">
<div id="actionpanel">
<div id="reportmarker" title="click to report this marker as invalid"></div>
<div id="vieweditmarker" class="view" title="click to edit this marker"></div>
</div><div id="star-rating" class="rating"></div>
<form id="markerForm" method="post" action="">
<table id="markertable">
<tr>
<td class="label">Title</td>
<td><input id="txtTitle" type="text" maxlength="70" /></td>
</tr>
<tr>
<td class="label">Goalsize</td>
<td><select id="selGoals">   <option value="1">2v2</option>   <option value="2">5v5</option>   <option value="3">7v7</option>   <option value="4">11v11</option>   </select></td>
</tr>
<tr>
<td class="label">Fieldsize</td>
<td><select id="selCapacity">   <option value="1">2v2</option>   <option value="2">5v5</option>   <option value="3">7v7</option>   <option value="4">11v11</option>   </select>
</td>
</tr>
<tr>
<td class="label">Fundament</td>
<td><select id="selFundament">   <option value="1">Grass</option>   <option value="2">Asphalt</option>   <option value="3">Growel</option>   <option value="4">Indoor</option>   </select>
</td>
</tr>
<tr>
<td class="label">Facilities</td>
<td>Stadium:<input type="checkbox" id="facStadium" />Waterpost:<input type="checkbox" id="facWaterpost" />Toilet:<input type="checkbox" id="facToilet" />Bench:<input type="checkbox" id="facBench" />Fence:<input type="checkbox" id="facFence" />
</td>
</tr>
<tr>
<td class="label">Extra</td>
<td><textarea id="txtExtra" rows="3" cols="20"></textarea></td>
</tr>
</table>
</form>
</div>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.6/jquery-ui.min.js"></script>
<script src="./application/js/jquery.uniform.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
console.log("what!");
alert("argh");
$(document).ready( function() 
{
console.log("markerform " , $("#markerForm").serialize());
});
});
</script>
</body>
</html>

标题
目标化
2v2 5v5 7v7 11v11
字段大小
2v2 5v5 7v7 11v11
基础
室内草地沥青咆哮
设施
体育场:水柱:厕所:长凳:围栏:
额外的
$(文档).ready(函数(){
console.log(“什么!”);
警报(“argh”);
$(文档).ready(函数()
{
log(“markerform”,$(“#markerform”).serialize();
});
});

HTML表单元素在
name
attr上操作,而不是在
id
attr上操作。所以你会想要一个例子

<input type="checkbox" name="facStadium" id="facStadium" />

然后当你调用serialize时,你应该把东西拿回来。另外,在彼此之间嵌套两个文档就绪处理程序可能也没有帮助;拆下内部的一个


(另外,每次使用表格进行布局时,都会有上千名web开发人员死亡。)

可能是因为您有两个嵌套的
$(文档)。准备好了吗

$(document).ready(function(){
    console.log("what!");
    alert("argh");
    $(document).ready( function() 
    {
        console.log("markerform " , $("#markerForm").serialize());
    });
});

是的,我通常不使用表,但是一个插件需要我:P,关于attr这个名字你是对的。真棒thx:)P.S我希望我没有杀了你或你的任何朋友