Hi
I'm learning the latest and greatest Angular using type script. I have an
ajax request that works fine in jQuery. I'm trying to convert this to a
post request. Below are the two calls. Does anyone see anything that I'm
doing wrong in the typescript or can help point me in the right direction?
Thanks
1. Working JQuery:
var url = "http://bsdevtest2/_layouts/15/GHC.WellnessClasses/ajax.ashx";
$.ajax({
url: url,
data: {
Function: "GetClassOfferings",
Host: "http://bsdevtest2"
},
type: 'POST',
success: function (json) {
alert(json.Offerings.Host);
},
error: function (xhr, err) {
},
complete: function () {
}
});
2. Attempt at Angular Service http post
getClassOfferings (): Observable <any> {
//var host = location.protocol + "://" + location.host;
var host = "http://bsdevtest2";
var parameter = JSON.stringify({Function:"GetClassOfferings", Host:host
});
return this.http.post(AJAX_URL, parameter)
.pipe(
tap(Offerings => this.log(`fetched class offerings`)),
catchError(this.handleError('getClassOfferings', []))
);
}
--
You received this message because you are subscribed to the Google Groups
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.