cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

CSRF token validation failed for my POST Method in SAPUI5 using Eclipse?

vamsilakshman_pendurti
Active Participant
0 Likes
14,758

Hi Experts,

Here i am facing one issue with Create an entry into Database Table using SAPUI5 & OData. Fetching the data from Database and displaying in our SAPUI5 application has been done perfectly using OData Service. Fetching purpose i used the below code...

Output:

when i was trying to create by clicking on Create button : below i am providing my code for Create (POST) Method...

when i click on Save button it will not triggering my jQuery.ajax line in my Controller code so that it displays else part message.

In DOM i got the error like CSRF token validation failed...

i searched in SCN with the above mentioned error wise, but no relevant solution is found. If any one face this kind of issue and resolved please guide me the steps...where exactly i did the mistake.

Thanks,

Vamsi.

View Entire Topic
junwu
SAP Champion
SAP Champion
0 Likes

why use jquery.ajax.....you are looking for trouble....

former_member340030
Contributor
0 Likes

Its ok Jun .. we can even use ajax .. might be his services not follow oData principles so why to use oData Model

vamsilakshman_pendurti
Active Participant
0 Likes

Hi,

Actually i don't know whether my services are following OData Principles OR not. Just i am practicing & i want to create one record in SAP DB using SAPUI5. I already done OData Service for that. Now for SAPUI5 i copied the logic from Internet Only ( jQuery.ajax ) ...

If there is any other better approach, please share with me...

Thanks ,

Vamc

former_member340030
Contributor
0 Likes

Yeah through oData you can do the CRUD operations ,that's the way we should do. Ajax is not recommended. Use oData model and the operations ... Just check out these blogs they are using oData ..

https://blogs.sap.com/2015/02/05/simple-exercise-on-odata-and-sap-ui5-application-for-the-basic-crud...

https://blogs.sap.com/2014/01/13/building-a-crud-application-with-sapui5-using-odata-model/

junwu
SAP Champion
SAP Champion
0 Likes

yes, of course, you can write plain html to code your web app. have fun....

junwu
SAP Champion
SAP Champion
0 Likes

use odatamodel to do the job.

vamsilakshman_pendurti
Active Participant
0 Likes

Hi Viplove,

I applied same code which you mentioned a link in previous post....

Here is my code...as shown below screen..

When i execute and want to create new record...it will display one popup as shown below..

When i click on Save Button then it will display as shown below screen shot...

That's it nothing will happened...

My 6th Record was not created ... Could you please look into this and give me the solution...

Thanks,

Vamc

former_member340030
Contributor
0 Likes

Hi

What error you are getting in the console or F12 networks tab ??

thanks

Viplove