Skip to main content
Level 3
May 2, 2023
Solved

Ajax call from Angular to Servlets are always calling twice

  • May 2, 2023
  • 3 replies
  • 1192 views

Hi Team,

I am making single Ajax calls from Angular to these 2 servlets on from My login component. But it always calls twice and couldn't able to find what was going wrong. Is this a product defect? Please help me to resolve this issue.

 

FYI,

AEM: 6.5.13

In general, all servlet calls are happening twice in AEM-SPA. (AEM + Angular)

The below thread also has the same issue, but no correct answer.

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/all-servlets-always-called-twice/m-p/404608#M28562

 

 

 

Regards,

Shyam

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Anmol_Bhardwaj

Hi @shyamasundar-ks ,

 

The way I would debug this would be as follows:

- Open browser developer console
- Search for the servlet called in the sources(JS) 

- Then put the breakpoint there.

- Check if the breakpoint is called twice. ( Which I think it would )
? If yes, the problem lies within the JS script, and you need to check why it is called twice.
> If not, the problem may be something else, and we need to investigate further.

3 replies

Anmol_Bhardwaj
Community Advisor
Anmol_BhardwajCommunity AdvisorAccepted solution
Community Advisor
May 2, 2023

Hi @shyamasundar-ks ,

 

The way I would debug this would be as follows:

- Open browser developer console
- Search for the servlet called in the sources(JS) 

- Then put the breakpoint there.

- Check if the breakpoint is called twice. ( Which I think it would )
? If yes, the problem lies within the JS script, and you need to check why it is called twice.
> If not, the problem may be something else, and we need to investigate further.

Nikhil-Kumar
Community Advisor
Community Advisor
May 2, 2023

@shyamasundar-ks  - Try debugging using browser console. Also see if you are not embedding multiple clientlibs.

arunpatidar
Community Advisor
Community Advisor
May 3, 2023

Hi,

You might have click event registered twice, can you please check?

Arun Patidar