Click here to Skip to main content
15,893,923 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
everybody, I have to use one API to post data to another website that website back data in callback response like this

postresult.showResult({
           callback: response => {
               console.log("callback", response);
           }
       });


how can I read data which comes from response despite I do too trials any added code stopped the response from working
any suggestions

What I have tried:

simple way to read is

alert(response );


and also try to read data from the console

console.defaultDebug = console.debug.bind(console);
        console.debugs = [];
        console.debug = function(){
            // default &  console.debug()
            console.defaultDebug.apply(console, arguments);
            // new & array data
            console.debugs.push(Array.from(arguments));
        }
Posted
Updated 20-May-20 3:23am
Comments
Richard Deeming 15-May-20 9:56am    
"Not working" doesn't tell us anything, and we can't see the code you've tried.

Is the expected response displayed in the browser's developer console?

Are you trying to read the response before the callback is called?
MR.alaa 15-May-20 10:09am    
i need to extarct item value id and description from
{
"id": "123456",
"object": "charge",
"live_mode": false,
"api_version": "V2",
"status": "INITIATED",
"amount": 1,

"description": "Test Description",
"metadata": {
"udf1": "test 1",
"udf2": "test 2"
},
"transaction": {
"timezone": "UTC+03:00",
"created": "1589562084460",
"url": "url",
"expiry": {
"period": 30,
"type": "MINUTE"
},
"asynchronous": false,
"amount": 1,
}
}
ZurdoDev 15-May-20 10:10am    
You first need to see what the response is. Is it json? xml? string? Then parse it or do whatever you need. If it's json, google how to parse json in javascript. If it's xml, same thing.
MR.alaa 15-May-20 10:12am    
it is json and i try alert(response.description); and always undifined
MR.alaa 15-May-20 10:52am    
Thanks done

1 solution

I have followed the code circle in console debuggers then I got it
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900