Skip to content

Instantly share code, notes, and snippets.

@kubicek
Forked from zalun/fiddle.css
Created November 4, 2012 09:36
Show Gist options
  • Save kubicek/4011065 to your computer and use it in GitHub Desktop.
Save kubicek/4011065 to your computer and use it in GitHub Desktop.
body {
font-family: Helvetica, Verdana
}
p {
padding: 7px 10px;
}
#demo {
border: 1px solid #999;
}
<div ng-app ng-controller="FetchCtrl">
ICO: <input type="text" ng-model="ico" ng-change="fetch()" size="80"/><button ng-click="fetch()">fetch</button><br>
DIC: <input type="text" ng-model="data.dic" size="80"/><br/>
firma: <input type="text" ng-model="data.firma" size="80"/><br/>
ulice: <input type="text" ng-model="data.ulice" size="80"/><br/>
mesto: <input type="text" ng-model="data.mesto" size="80"/><br/>
psc: <input type="text" ng-model="data.psc" size="80"/><br/>
<pre>http url: {{url}}</pre>
<pre>http status code: {{status}}</pre>
<pre>form data: {{data}}</pre>
</div>
function FetchCtrl($scope, $http, $templateCache) {
$scope.method = 'GET';
$scope.ico = "67787231";
$scope.fetch = function() {
$scope.code = null;
$scope.data = null;
$scope.url = "http://www.lepsipraha7.cz/ares.php?ico=" + $scope.ico;
$http({
method: $scope.method,
url: $scope.url,
cache: $templateCache
}).success(function(data, status) {
$scope.status = status;
$scope.data = data;
}).error(function(data, status) {
$scope.data = data || "Request failed";
$scope.status = status;
});
};
}​
name: Request.HTML - jsFiddle/Gist integration demo
description: jsFiddle demo hosted on Gist using HTTP Request to get ARES data
authors:
- Jiri Kubicek
resources:
- /js/empty.js
- /css/normalize.css
normalize_css: no
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment