Advertisement
julong

Fix Cross Domain Ajax Request in AngularJS (CORS)

Mar 18th, 2015
304
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.24 KB | None | 0 0
  1. <html>
  2. <head>
  3. <title>Laravel</title>
  4.  
  5. <link href='//fonts.googleapis.com/css?family=Lato:100' rel='stylesheet' type='text/css'>
  6.  
  7. <style>
  8. body {
  9. margin: 0;
  10. padding: 0;
  11. width: 100%;
  12. height: 100%;
  13. color: #B0BEC5;
  14. display: table;
  15. font-weight: 100;
  16. font-family: 'Lato';
  17. }
  18.  
  19. .container {
  20. text-align: center;
  21. display: table-cell;
  22. vertical-align: middle;
  23. }
  24.  
  25. .content {
  26. text-align: center;
  27. display: inline-block;
  28. }
  29.  
  30. .title {
  31. font-size: 96px;
  32. margin-bottom: 40px;
  33. }
  34.  
  35. .quote {
  36. font-size: 24px;
  37. }
  38. </style>
  39. <script src="http://code.jquery.com/jquery-2.1.0.min.js"></script>
  40. <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.14/angular.min.js"></script>
  41. <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css"/>
  42. <link href='http://fonts.googleapis.com/css?family=Roboto:400,500' rel='stylesheet' type='text/css'>
  43. <link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-glyphicons.css" rel="stylesheet">
  44.  
  45. </head>
  46. <body ng-app="myApp">
  47. <div class="container" ng-controller="MyCtrl">
  48. <div class="content">
  49. <div class="title">Laravel 5</div>
  50. <div class="quote">{{ Inspiring::quote() }}</div>
  51. <p ng-repeat="c in cdata">
  52. @ c.name @
  53. </p>
  54. </div>
  55. </div>
  56. <script>
  57. /*
  58. var commentApp = angular.module('commentApp',['mainCtrl','commentServices'],function($interpolateProvider){
  59. $interpolateProvider.startSymbol('<%');
  60. $interpolateProvider.endSymbol('%>');
  61. });
  62. */
  63. var myApp=angular.module("myApp",[]);
  64. myApp.config(function($interpolateProvider) {
  65. $interpolateProvider.startSymbol('@');
  66. $interpolateProvider.endSymbol('@');
  67. });
  68.  
  69. myApp.controller("MyCtrl",['$scope','$http','$window',function($scope,$http){
  70.  
  71. $http.get('http://giant9.com/testpost/get').success(function(data){
  72. $scope.cdata = data;
  73. console.log(data);
  74. });
  75. }]);
  76.  
  77. </script>
  78.  
  79. {!! Form::open() !!}
  80. <div class="form-group">
  81. {!! Form::label('task', 'Task') !!}
  82. {!! Form::text('task', null, ['class' => 'form-control']) !!}
  83. </div>
  84. {!! Form::close() !!}
  85. </body>
  86. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement