title: Ionic 2 Http POST Method ERROR
body: <p>Hi Im going to call http post method using ionic 2.but in the response always im getting error.can any one help me.</p>
  
  <p>this is my json type</p>
  
  <pre><code>{
  “username”:”user”,
  "password":”pass"
  }
  </code></pre>
  
  <p>This is my code</p>
  
  <pre><code>import {Page, NavController} from 'ionic-angular';
  import {Http, Headers, RequestOptions} from 'angular2/http';
  import 'rxjs/Rx';
  @Page({
    templateUrl: 'build/pages/home/home.html'
  })
  export class HomePage {
    constructor(http: Http, nav: NavController) {
      this.http = http;
      this.makePostRequest();
    }
  
    makePostRequest() {
  
      var headers = new Headers();
      headers.append('Content-Type', 'application/json');
      this.http.post('url',
        JSON.stringify({ username: 'admin', password: 'a' }),
        { headers: headers })
        .map((res: Response) =&gt; res.json())
        .subscribe((res) =&gt; console.log("res", res));
  
    }
  
  }
  </code></pre>
  
  <p>error Log</p>
  
  <pre><code>4     236980   log      DEVICE READY FIRED AFTER, 1437, ms
  5     237420   group    EXCEPTION: [object Object]
  6     237426   error    EXCEPTION: [object Object]
  7     237431   error    STACKTRACE:
  8     237433   error    
  9     237435   groupEnd 
  10    237525   error    Uncaught #&lt;Response&gt;, http://192.168.1.13:8100/build/js/app.bundle.js, Line: 7834
  </code></pre>
  
  <p>How can i solve this.?</p>
  
  <p>I added the error handling</p>
  
  <p>this is the log in browser</p>
  
  <pre><code>Failed to load resource: the server responded with a status of 403 (Forbidden)
  (index):1 XMLHttpRequest cannot load http://url/login/. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8100' is therefore not allowed access. The response had HTTP status code 403.
  app.bundle.js:67773 error Response_body: ProgressEventbubbles: falsecancelBubble: falsecancelable: falsecurrentTarget: XMLHttpRequestonabort: undefinedonerror: undefinedonload: undefinedonloadend: undefinedonloadstart: undefinedonprogress: undefinedonreadystatechange: undefinedontimeout: undefinedreadyState: 0response: ""responseText: ""responseType: ""responseURL: ""responseXML: nullstatus: 0statusText: ""timeout: 0upload: XMLHttpRequestUploadonabort: nullonerror: nullonload: nullonloadend: nullonloadstart: nullonprogress: nullontimeout: null__proto__: XMLHttpRequestUploadconstructor: XMLHttpRequestUpload()arguments: nullcaller: nulllength: 0name: "XMLHttpRequestUpload"prototype: XMLHttpRequestUploadconstructor: XMLHttpRequestUpload()arguments: nullcaller: nulllength: 0name: "XMLHttpRequestUpload"prototype: XMLHttpRequestUpload__proto__: XMLHttpRequestEventTarget()&lt;function scope&gt;onabort: (...)onerror: (...)onload: (...)onloadend: (...)onloadstart: (...)onprogress: (...)ontimeout: (...)Symbol(Symbol.toStringTag): "XMLHttpRequestUpload"__proto__: XMLHttpRequestEventTarget__proto__: XMLHttpRequestEventTarget()&lt;function scope&gt;onabort: (...)onerror: (...)onload: (...)onloadend: (...)onloadstart: (...)onprogress: (...)ontimeout: (...)Symbol(Symbol.toStringTag): "XMLHttpRequestUpload"__proto__: XMLHttpRequestEventTargetwithCredentials: false__proto__: XMLHttpRequestdefaultPrevented: falseeventPhase: 0isTrusted: trueisTrusted: truelengthComputable: falseloaded: 0path: Array[0]returnValue: truesrcElement: XMLHttpRequesttarget: XMLHttpRequesttimeStamp: 2726.8050000000003total: 0type: "error"__proto__: ProgressEventheaders: Headers_headersMap: Mapsize: (...)__proto__: Map&lt;entries&gt;[0]No Entries__proto__: Objectstatus: 200statusText: "Ok"type: 3url: null__proto__: ObjectarrayBuffer: ()blob: ()constructor: Response(responseOptions)arguments: [Exception: TypeError: 'caller' and 'arguments' are restricted function properties and cannot be accessed in this context.
      at Function.remoteFunction (&lt;anonymous&gt;:3:14)]caller: (...)length: 1name: "Response"prototype: Object__proto__: ()&lt;function scope&gt;json: ()arguments: (...)caller: (...)length: 0name: ""prototype: Object__proto__: ()&lt;function scope&gt;text: ()__proto__: Object
  </code></pre>