SOURCE

console 命令行工具 X clear

                    
>
console
onload = function() {

	// parameters for httpRequest
	var url = 'http://services.odata.org/V4/Northwind/Northwind.svc/Categories';
	var params = {
		'$format': 'json',
  	'$select': 'CategoryID,CategoryName,Description'
	};
  
	// make the request
	wijmo.httpRequest(url, {
  	data: params,
    success: function(xhr) {
    
    	// show results in a grid
      var grid = new wijmo.grid.FlexGrid('#theGrid', {
      	isReadOnly: true,
      	itemsSource: JSON.parse(xhr.responseText).value
      });
      
      // make last column fill the grid
			grid.columns[grid.columns.length - 1].width = '*';
    }
  })
}
<div class="container">

  <h1>
    wijmo.httpRequest 方法
  </h1>
  <p>
   HTTP请求是Web应用程序与服务器交换数据的基本机制.</p>
  <p>
   许多JavaScript工具包和框架都有自己的包装器来进行HTTP请求。 例如,Angular有一个
    <a href="https://docs.angularjs.org/api/ng/service/$http" target="_blank">$http</a> 服务,
   jQuery有一个
    <a href="http://api.jquery.com/jquery.ajax/">ajax()</a> 方法.
    如果您习惯这种方式也可以在Wijmo中使用.</p>
  <p>
  如果要减少对外部工具包和框架的依赖,可以使用Wijmo简单灵活的 
    <b>httpRequest</b> 方法.</p>
  <p>
    下面的示例通过从Microsoft的Northind OData示例服务检索一些数据,并使用它来填充FlexGrid:</p>    
  <div id="theGrid"></div>
</div>
.wj-flexgrid {
  max-height: 200px;
}
table {
  width: 100%;
}
#theColor {
  width: 150px;
  height: 150px;
  margin: 12px auto;
  border: 2px solid black;
  background-color: grey;
}