jQuery populate items into a Select using jQuery ajax json, php

后端 未结 4 449
感动是毒
感动是毒 2020-12-14 05:05

I have a select field. I must fill with options taken from a mysql table.
Here is some little php code I have done using codeigniter framework

$idcateg =         


        
4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-14 05:26

    you could also just use $().load() and have your PHP code generate the tags

      $return = "";
      while ($row = mysql_fetch_array($res)) {
        $value = $row['value'];
        $text = $row{'text'];
        $return .= "\n";
      }
    print $return;
    }
    

    ...

    $('#select').load("index.php/rubro/list_ajax/");
    

提交回复
热议问题