Objective: How can I retrieve the specific value "test" in Angular?
Issue: An error message is being displayed.
Error: SyntaxError: Unexpected token e in JSON at position 1 at JSON.parse ()
Which syntax element am I missing?
ASP.NET
// Retrieve "test" from https://localhost:44353/api/Jobadvertisement/VVValidate/4
[HttpGet("VVValidate/{id:int}")]
public ActionResult<String> VVValidate(int id)
{
return "test";
}
Angular
const url = environment.url
let apiUrl = url + 'api/Jobadvertisement/VVValidate/' + "4";
var response = this.http.get(apiUrl).subscribe(data => {
console.log(data);
});