Advertisement
Guest User

Untitled

a guest
Sep 18th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. var headers = new Headers();
  2. headers.append('Content-Type', 'application/x-www-form-urlencoded');
  3. this.http.post('http://localhost/jiffy_fun/laravel/public/token',{headers: headers}).map(res => res.json()).subscribe(res => {this.token = res});
  4.  
  5. var creds = "username=" + username + "&password=" + password;
  6.  
  7. var headers = new Headers();
  8. headers.append('Content-Type',
  9. 'application/x-www-form-urlencoded');
  10. this.http.post(
  11. 'http://localhost/jiffy_fun/laravel/public/token',
  12. creds,
  13. {headers: headers})
  14. .map(res => res.json())
  15. .subscribe(res => {this.token = res});
  16.  
  17. let headers = {
  18. 'Content-Type' : 'application/x-www-form-urlencoded'
  19. }
  20. let options = new RequestOptions({ headers: headers, withCredentials: true });
  21.  
  22. this.http.post('http://localhost/jiffy_fun/laravel/public/token',JSON.stringify({}),options).map(res => res.json()).subscribe(res => {this.token = res});
  23.  
  24. // Http post function declaration
  25. post(url: string, body: string, options?: RequestOptionsArgs) : Observable<Response>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement