Similar function for jquery.ajax in angular2/ionic2

I have this piece of jQuery code that works fine cross-origin:

    url: "",
    type: "POST",        
    dataType: 'jsonp',
    jsonp: 'jsonp',
    data: JSON.stringify({"foo":"bar"}),
    contentType: "application/json; charset=utf-8",
    success: function (response) {
    error: function (response) {

I’m a novice to ionic2. I’m trying to convert this to Angular2/ionic2 code but there is no success.

Is there any similar function for jquery.ajax in angular2/ionic2.
I’m not getting how to deal with the above code in angular2/ionic2 using this.http.get or or this.jsonp.request.

Any help appreciated.

Thanks in advance.

You might do something like this:

	    let headers = new Headers();
	    headers.append('Content-Type', 'application/json');'', JSON.stringify({"foo":"bar"}), {headers: headers})
	      .subscribe(res => {
	      }, (err) => {

Make sure to import both Http and Headers.

In such transition, it’s worthwhile to understand the difference between promise(jq.ajax) and observable(

hi @itlr, I am new to angular2/ionic2 and confuesd with observables and promises… and went through suggested video by you earlier… but I didn’t make out to work with observables for jsonp

@joshmorony no success… I followed what suggested by you…