Click here to Skip to main content
14,545,210 members
Rate this:
Please Sign up or sign in to vote.
See more:
everybody, I have to use one API to post data to another website that website back data in callback response like this

           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
Updated 20-May-20 3:23am
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
ZurdoDev 15-May-20 10:54am
Did you get it figured out? If so, please post something as a solution so that this no longer shows as unanswered.

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

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

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

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100