Есть index.php следуюшего содержания
CODE (htmlphp):
скопировать код в буфер обмена
скопировать код в буфер обмена
- <?php
- require_once("config.php");
- function ArrayData($Result)
- {
- $Data = array();
- while($Row = pg_fetch_assoc($Result))
- {
- $Data[] = $Row;
- }
- return $Data;
- }
- $ConString = "host=".$dbhost." port=".$dbport." dbname=".$dbname." user=".$dbuser." password=".$dbpass." options='--client_encoding=utf8'";
- $Connection = @pg_connect($ConString);
- if(!$Connection)
- {
- echo "Fail connection to DB";
- exit;
- }
- $Result = @pg_query($Connection, 'очень длинный запрос к базе, чтоб не мешался удалил');
- if(!$Result)
- {
- echo "Fail query";
- echo pg_last_error($Connection);
- exit;
- }
- $i = 1;
- while($row = pg_fetch_assoc($Result))
- {
- $res .= <<<HTML
- {
- num:{$i},
- txt_1:"{$row['txt_1']}",
- txt_2:"{$row['id']}",
- txt_3:"{$row['dt']}",
- txt_4:"{$row['slugba']}",
- txt_5:"{$row['nakrutka']}",
- txt_6:"{$row['txt_6']}",
- },
- HTML;
- $i++;
- }
- ?>
- <!DOCTYPE html>
- <html lang="ru">
- <head>
- <meta charset="UTF-8">
- <title>table</title>
- <script src="/js/jquery.js"></script>
- <link rel="stylesheet" href="/css/webix.css" type="text/css" charset="utf-8">
- <script src="js/webix.js" type="text/javascript" charset="utf-8"></script>
- <link rel="stylesheet" type="text/css" href="/js/common/samples.css?v=<?=time();?>">
- <style>
- body {margin: 0; padding: 0;}
- </style>
- </head>
- <body>
- <div id="testA" class="cont"></div>
- <script type="text/javascript" charset="utf-8">
- var test;
- function show()
- {
- $.ajax({
- url: "/ajax.php",
- //type: "POST",
- //dataType: 'json',
- cache: false,
- success: function(html)
- {
- test = [ html ]; // собственно значение этой переменной должно передаться как та....
- },
- complete: function()
- {
- show();
- }
- });
- }
- $(document).ready(function()
- {
- show();
- webix.ui(
- {
- container:"testA",
- view:"datatable",
- columns:[
- { id:"num", width: 50, header:"№" },
- { id:"txt_1", width: 150, header:"title 1" },
- { id:"txt_2", width: 150, header:"title 2" },
- { id:"txt_3", width:150, header:"title 3" },
- { id:"txt_4", width:150, header:"title 4" },
- { id:"txt_5", width:100, header:"title 5" },
- { id:"txt_6", width:80, header:"title 6" },
- ],
- select:"cell",
- height:500,
- autowidth:true,
- data: test // здесь пробую подставить значения, но соотвественно переменная не видна
- });
- });
- </script>
- </body>
- </html>