cancel
Showing results for 
Search instead for 
Did you mean: 

Calling BSP with AJAX does not work

Former Member
0 Kudos

Hello,

i'm trying to send formular data via ajax to an bsp page.

The problem is, that the bsp site does not even start

here is my ajax part from the html page:



url = 'kommentar_id=' + comment_id + '&comment=' + escape(document.getElementById(my_id).value);

http_request.open('POST', '/sap/bc/bsp/zre_kommentare2/kommentar_speichern.htm', true);
http_request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
http_request.setRequestHeader("Content-length", url.length);
http_request.send(url);

In the onRequest event of the bsp page i have an infinite loop. But there is no process in SM66 when i submit the html formular.

When i use the GET method, the bsp page is called, and there is a process in the infinite loop.

Result: when i use GET, it works

when i use POST, it doesn't work

Any ideas ?

Regards,

Tobias

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

the working app is using the GET method.

But my problem is, that we have more data to transfer --> textarea

The is a size limitation on GET.

I need to switch to POST.

Thanks,

Tobias

Former Member
0 Kudos

Hi Tobias,

I have no problems using AJAX ,BSP through a get method. I've read that sometimes AJAX behaves a little peculiar based on the calling order. I have some code below as reference.

xmlHttpPollLog2.open("GET",url2,true);

xmlHttpPollLog2.onreadystatechange=salary_struct_changed;

xmlHttpPollLog2.send(null);

function salary_struct_changed()

{

if (xmlHttpPollLog2.readyState==4 || xmlHttpPollLog2.readyState=="complete")

{

}

}