ember.js - Emberjs 2 remove CORS and CSP -
i'm trying emberjs 2 , found problem making ajax requests. have read lot of questions on stackoverflow , still can't resolve problem. access emberapp http://localhost:4200 , api server(php) in http://localhost. below screen shoot of console.
what should step step? can me please?
thanks in advance.
routes/users.js
import ember 'ember'; export default ember.route.extend({ model(){ console.log($.getjson('http://localhost/api')); } });
environment.js:
module.exports = function(environment) { var env = { /*......*/ contentsecuritypolicy:{ 'connect-src':" 'self' http://localhost ", 'font-src' : " 'self' http://localhost " } /*......*/ };
this in php localhost/api/index.php:
<?php header("access-control-allow-origin: *"); $array = array( 'name'=>"firstname", 'lastname' => 'lastname', 'age'=>'23' ); echo json_encode($array);
ember server --proxy http://localhost:80
will proxy ajax requests address.
Comments
Post a Comment