cancel
Showing results for 
Search instead for 
Did you mean: 

AJAX http call and callback function

0 Kudos

Hi,

I am trying to do http POST using AJAX call.

However the call works fine in debugging and does not when directly run.

I am using the syntax as below:

$.ajax({

url: "URL",

contentType: "application/json; charset=utf-8",

dataType: "json",

type: "POST",'

data: <jsondata>,

async: true,

success: function(response) {

console.log(response);

},

error: function(response){

console.log(response);

}

});

I am unable to figure out why, could anyone please help.

SergioG_TX
Active Contributor
0 Kudos

are you getting any errors? the best way would be to set a breakpoint in your browser ... then see where the execution goes. if you do get an error, what is it? that may be helpful to solve the issue.

sometimes when posting to HANA, you may need to GET first, in order to get a token, then you can use that token on your follow up request to POST

hope this helps - good luck

0 Kudos

Hi Sergio,

I am actually passing data from file upload. Finally I figured out that its because of the asynchronous calls.

I need to use FileReader() object and use the event method onloadend and bracket the above code inside.

Thanks for your reply.

Accepted Solutions (0)

Answers (0)