If this is the code you're using then straight away the HTTP request isn't going to work because you're returning from the method before it can even run:
alert(varCnNo);
return true;
If you get rid of the
return
statement then the request can process. Otherwise, have you tried also subscribing to the
catch()
of the
Promise<>
to handle when errors happen? Using the
catch()[
^] method can provide you a means to report errors.
Also, be aware some websites have origin restrictions for requests, so if you're running this locally or from another website then the request could be blocked for not originating from the same domain.