duanbi7247 2017-01-14 21:24
浏览 35

如何使用ajax服务将gujarati或hindi数据从php转换为javascript

I want to show hindi or gujarati data to the table using DataTable.js API. i have following javascript code :

$(document).ready(function(){
  // On page load: datatable
  var url = "<?php echo base_url();?>list?job=get_companies";
  var table_companies = $('#table_companies').dataTable({
    "ajax": url,
    "lang": "//cdn.datatables.net/plug-ins/9dcbecd42ad/i18n/Gujarati.json",
    "language": {
                "url": "//cdn.datatables.net/plug-ins/9dcbecd42ad/i18n/Gujarati.json"
            },
    "columns": [
      { "data": "id" },
      { "data": "text",   "sClass": "Text" },
      { "data": "userid" }

    ],
    "aoColumnDefs": [
      { "bSortable": false, "aTargets": [-1] }
    ],
    "lengthMenu": [[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]],
    "oLanguage": {
      "oPaginate": {
        "sFirst":       " ",
        "sPrevious":    " ",
        "sNext":        " ",
        "sLast":        " ",
      },
      "sLengthMenu":    "Records per page: _MENU_",
      "sInfo":          "Total of _TOTAL_ records (showing _START_ to _END_)",
      "sInfoFiltered":  "(filtered from _MAX_ total records)"
    }
  });
  });

and then i was give response from php file look like (there is to three parameter to the array and the data have string of hindi or Gujarati data format thne how to set data using dataTable.js):

$data = array(
              "result"  => $result,
              "message" => $message,
              "data"    => $mysql_data
            );

            // Convert PHP array to JSON array
            $json_data = json_encode($data);
            print $json_data;
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 Python输入字符串转化为列表排序具体见图,严格按照输入
    • ¥20 XP系统在重新启动后进不去桌面,一直黑屏。
    • ¥15 opencv图像处理,需要四个处理结果图
    • ¥15 无线移动边缘计算系统中的系统模型
    • ¥15 深度学习中的画图问题
    • ¥15 java报错:使用mybatis plus查询一个只返回一条数据的sql,却报错返回了1000多条
    • ¥15 Python报错怎么解决
    • ¥15 simulink如何调用DLL文件
    • ¥15 关于用pyqt6的项目开发该怎么把前段后端和业务层分离
    • ¥30 线性代数的问题,我真的忘了线代的知识了