我有以下代码:
<h3> Your Profile </h3>
The information below is what we have on file for you.
<form id="profileform" name="profileform" action="">
<table>
<?php
$profile_array = select_profile_data($_SESSION['id']);
while (list($key, $value) = each($profile_array)) {
if(!in_array($key,$dont_display_list,true)) {
echo '<tr><td>'.$key.'</td><td><input type="text" name=' . $key . ' value="'.$value.'"</td></tr>';
}
}
?>
</table>
<input type="button" value="submit changes" name="submit" onClick="button_click('profileform')">
</form>
<script type='text/javascript'>
function button_click(formname) {
var fullselect = formname + " :input";
alert(fullselect);
var values = $(fullselect);
alert(values.size());
$("#content").html('<span>Loading...</span>');
$("#content").load('profile.php', values, function(response, status, xhr) {
if (status == "error") {
var msg = "Sorry but there was an error: ";
$("#content").html(msg + xhr.status + " " + xhr.statusText);
}
});
}
我在“fullselect”处的警报向我显示了预期的 jquery 选择器字符串“profileform:input”。但是,我的“值”变量总是返回“0”的大小。虽然表格中肯定有“输入变量”。关于我在这里出错的任何想法?
谢谢,