没什么大不了。
$idcateg = trim($this->input->post('idcategory'));$result = array();$id = mysql_real_escape_string($idcateg);$res = mysql_query("SELECt * FROM subcategories WHERe category = $id");while ($row = mysql_fetch_array($res)) { $result[] = array( 'id' => $row['subcatid'], 'desc' => $row['description'], );}echo json_enpre($result);
与:
$.post("<?=base_url()?>index.php/rubro/list_ajax/", { 'idcategory' : idc }, function(data) { var sel = $("#select"); sel.empty(); for (var i=0; i<data.length; i++) { sel.append('<option value="' + data[i].id + '">' + data[i].desc + '</option>'); } }, "json");
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)