dps69208 2017-12-09 03:13
浏览 106
已采纳

在ajax中显示数据库中的数据

I want to show data from database into ajax.

function Data_Table() {
  $.ajax( {
    url: "<?php echo site_url('admin-spot/company/FieldTable')?>", type: "GET", dataType: "JSON", success: function(data) {
      $('#map').dataSrc(data.map);
    }
  }
  );
}
<iframe id="map" src="" frameborder="0" style="width: 100%; height: 300px;" allowfullscreen></iframe>

</div>
  • 写回答

2条回答 默认 最新

  • du8794 2017-12-09 03:59
    关注

    As far as i understand from your hard to judge description and the comments section, you are trying to set the src attribute of the iframe with the googlemap link in the ajax success function and the src is coming from server-side, if this is it you have to use .prop to assign the src which should be a URL

    change your function to the following

     function Data_Table() {
    
            $.ajax({
                url: "<?php echo site_url('admin-spot/company/FieldTable')?>",
                type: "GET",
                dataType: "JSON",
                success: function (data) {
    
                    $('#map').prop('src',
                        data.map
                    );
                }
            });
        }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?