Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

211
Views
How to make a FORM PUT request through rxjs ajax?

Jquery request objects have a property by the name 'data' which is used to set form data and make a form request with the right headers.

I wanted to achieve the same in rxjs ajax but could not find a way. The only exhaustive list of request configuration properties I could find was this https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/doc/operators/ajax.md

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

The documentation for RxJS5 is not complete yet on that part, but you can use it as follows:

 import {Observable} from "rxjs/Observable";
 import "rxjs/add/observable/dom/ajax";

 const url = "http://my-site.org/some/endpoint";
 const request$ = Observable.ajax.put(url, {a: "test"});
 request$.subscribe(x => console.log(x));

And of course all other REST-methods are available

  Observable.ajax(urlOrRequest: string | AjaxRequest): Observable<AjaxResponse>;
  Observable.ajax.get(url: string, headers?: Object): Observable<AjaxResponse>;
  Observable.ajax.post(url: string, body?: any, headers?: Object): Observable<AjaxResponse>;
  Observable.ajax.put(url: string, body?: any, headers?: Object): Observable<AjaxResponse>;
  Observable.ajax.patch(url: string, body?: any, headers?: Object): Observable<AjaxResponse>;
  Observable.ajax.delete(url: string, headers?: Object): Observable<AjaxResponse>;
  Observable.ajax.getJSON<T>(url: string, headers?: Object): Observable<T>;

If you want to send a fully custom ajax-request, you can use the following interface:

interface AjaxRequest {
  url?: string;
  body?: any;
  user?: string;
  async?: boolean;
  method?: string;
  headers?: Object;
  timeout?: number;
  password?: string;
  hasContent?: boolean;
  crossDomain?: boolean;
  withCredentials?: boolean;
  createXHR?: () => XMLHttpRequest;
  progressSubscriber?: Subscriber<any>;
  responseType?: string;
}

All take from here: https://github.com/ReactiveX/rxjs/blob/0ab1d3b4d1178a1d31c49c737832cde767da3fb1/src/observable/dom/AjaxObservable.ts

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!