Expand my Community achievements bar.

SOLVED

Ajax call from Angular to Servlets are always calling twice

Avatar

Level 3

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

shyamasundarks_0-1683035856478.png

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...

 

 

 

Regards,

Shyam

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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

Avatar

Correct answer by
Community Advisor

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.

Avatar

Community Advisor

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

Avatar

Community Advisor

Hi,

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