Learn about Redwood and be one of the first to join the conversation

Visit Redwood Community
Calling Rest API Via Java script-- Not Working — Cloud Customer Connect
You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

Calling Rest API Via Java script-- Not Working

Received Response
14
Views
1
Comments
edited Jul 9, 2021 12:58PM in Visual Builder 1 comment

Summary

Calling Rest API Via Java script-- Not Working

Content

Hello All,

I am trying to execute a rest api via java script. Its not working .

Please see below part of the code and if possible advise where I am wrong.

Thanks

 

 

define(['vb/helpers/rest'], function (Rest) {
  'use strict';
 
  var PageModule = function PageModule() { };
 
  /**
   *
   * @param{String} arg1
   * @return{String}
   */
  PageModule.prototype.getResult = function (arg1) {
    var returnValue = 200;
    var resultCallback = endpoint.fetch();
    resultCallback.then(function (payload) {
      if (payload.response.status === 200) {
        if (payload.body.count > 0) {
          return returnValue;
        } 
      }
    });
 
    return 'err';
 
  };


 
  return PageModule;

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!