用ajax传递变量给PHP(使用了smarty),提示未定义变量 JS源码: function get_value_optgroup(form){ var opts; var subject_class; var url; opts=sub_class.options[sub_class.selectedIndex].parentNode.attributes; subject_class=opts["label"].value; //--------------------------------------- //使用ajax发送选中的运算类 url = "compute.php?subject_class="+subject_class; xmlhttp.open("POST",url,true); //--------------------------------------- }