May 1, 2016

How to check response.getReturnValue() returned value or not?

We can use console() to check in Browser Console.

console.log( 'Data - ' + JSON.stringify( response.getReturnValue() ) );

(Or)

Use the below code to check response.getReturnValue() returned value or not

response.getReturnValue().length > 0

4 comments:

  1. Use either Console.log or alert ;)

    ReplyDelete
  2. var state = response.getState();
    if (state === "SUCCESS")

    ReplyDelete
  3. What would be it's equivalent in LWC?

    ReplyDelete
    Replies
    1. You use if ( data ) { } in LWC if you are using wire.
      Sample code - https://www.infallibletechie.com/2020/04/how-to-wrap-text-in-table-in-lwc-in.html

      Delete