Warning: include_once(/home/sites/heteml/users/m/o/r/moriya-h5/web/confrage/bin/headers.php): failed to open stream: No such file or directory in /home/users/2/moriya-h5/web/confrage/ajax/jquery/serialize.html on line 1
Warning: include_once(): Failed opening '/home/sites/heteml/users/m/o/r/moriya-h5/web/confrage/bin/headers.php' for inclusion (include_path='.:/usr/local/php/5.6/lib/php') in /home/users/2/moriya-h5/web/confrage/ajax/jquery/serialize.html on line 1
form内の要素を文字列データにシリアライズする関数です。
以下、サンプルソースです。
<html>
<head>
<title></title>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">google.load("jquery", "1.3");</script>
<script type="text/javascript">
$(document).ready(function(){
function showValues() {
var str = $("#test_form").serialize();
$("#result").text(str);
}
$("select").change(showValues);
});
</script>
</head>
<body>
<form id="test_form">
<p>
<input type="text" id="text" name="text" />
<select name="select">
<option>test1</option>
<option>test2</option>
</select><br />
</p>
</form>
<div id="result"></div>
</body>
</html>
以下、実行例です。セレクトボックスが変わった場合のみクエリ文字列が表示されます。
Warning: include_once(/home/sites/heteml/users/m/o/r/moriya-h5/web/confrage/bin/footer.php): failed to open stream: No such file or directory in /home/users/2/moriya-h5/web/confrage/ajax/jquery/serialize.html on line 48
Warning: include_once(): Failed opening '/home/sites/heteml/users/m/o/r/moriya-h5/web/confrage/bin/footer.php' for inclusion (include_path='.:/usr/local/php/5.6/lib/php') in /home/users/2/moriya-h5/web/confrage/ajax/jquery/serialize.html on line 48