i have the following code:
<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);
}
});
}
my alert at “fullselect” shows me the expected jquery selector string ‘profileform :input’. However, my “values” variable always returns a size of “0”. While there are definitely “input variables” in the form. Any thoughts on where i’m going wrong here?
thanks,
You missed the
#from the start of theformnamevariable, as it is theidof the form:Also, the
valuesvariable will be an array of jQuery objects, so it won’t be valid for you to pass accross to your PHP using theload()method. The best thing to do is toserialize()the entire form and pass that: