ajax call teaser page components. | Community
Skip to main content
Rama_Atmakur
Level 2
October 16, 2015
Solved

ajax call teaser page components.

  • October 16, 2015
  • 2 replies
  • 699 views

We have component that makes jquery ajax call to load some json. This component is used in a teaser page. When I hit the teaser with teaser.html the ajax call happens and the json is rendered. But when this teaser is resolved via segmentation and when this loads the page then this ajax call does not happen. The rendered html has the <script> element where ajax call needs to happen.

Any ideas?

Regards

Rama.

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 Rama_Atmakur

Sham, thanks for your quick attention. It turned out that we have to use CQ.shared.HTTP.get(url, function() {}); rather than juery.Ajax. The issue was to execute an another ajax call on a teaser load while the teaser itself was loaded via ajax. so the 2nd ajax call was not happening because after first ajax call to load the teaser the script tags on the teaser page were treated like txt rather than executable java script. But some how this went away if I use CQ get api rather than jquery ajax api.

Regards

Rama.

2 replies

Sham_HC
Level 10
October 16, 2015

   Most of the time the root cause seems to be with some custom javascript the way it gets loaded. Is the url of page publicly accessible? 

Rama_Atmakur
Rama_AtmakurAuthorAccepted solution
Level 2
October 16, 2015

Sham, thanks for your quick attention. It turned out that we have to use CQ.shared.HTTP.get(url, function() {}); rather than juery.Ajax. The issue was to execute an another ajax call on a teaser load while the teaser itself was loaded via ajax. so the 2nd ajax call was not happening because after first ajax call to load the teaser the script tags on the teaser page were treated like txt rather than executable java script. But some how this went away if I use CQ get api rather than jquery ajax api.

Regards

Rama.