如何逐列名称getJSON和php选择所有项目

时间:2015-08-25 05:49:54

标签: php mysql json

我对php函数进行了getJSON调用,该函数按列名返回列中的所有项。这是PHP函数。

public function getCertsByCategory($certCategory) {
       $connection = $this -> connect();
       return $this -> select("select '.$certCatogory.' from cert_catalog");
    }

这是获取数据的功能:

function CertName(certCategory) {
       $('#certificationName').empty();
       console.log(certCategory);
       $.getJSON('json_data.php', { method: 'getCertsByCategory', certCategory: certCategory }, function(data) {
          console.log(data);
          $.each(data, function(key, value) {
             console.log(value);
             $('#certificationName').append('<option value="' + value + '">' + value + '</option>');
          });
       });
     }

为什么我会为这些值取回两个点?这就是Chrome开发人员工具中的样子。

10: Object
..: ".."
__proto__: Object
11: Object
..: ".."
__proto__: Object

0 个答案:

没有答案