试试这个:
<script>
function get()
{
$.post("handle.php",{type:"get",tablename:GLOBAL_TABLE,fields:GLOBAL_FIELDS),function(data)
{
var fieldValues = data.split(','),
fieldNames = GLOBAL_FIELDS.split(',');
for(var ind = 0; ind < fieldNames.length; ind++) {
$("#"+fieldName[ind])=fieldValues[ind];
}
}
});
}
function set()
{
var fieldValues = "",
fieldNames = GLOBAL_FIELDS.split(',');
for(var ind = 0; ind < fieldNames.length; ind++) {
valuesI += ((fieldValues.length == 0) ? "" : ",") + unescape($("#"+fieldName[ind]).val());
}
$.post("handle.php",{type:"set",tablename:GLOBAL_TABLE,fields:GLOBAL_FIELDS,values:valuesI), function(data)
{
if (data!=null)
alert ("error");
}
});
}
</script>