Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9152883
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:09:49+00:00 2026-06-17T12:09:49+00:00

There is a situation I am having with jQuery. In particular its prettyPhoto library

  • 0

There is a situation I am having with jQuery. In particular its prettyPhoto library and getJSON function.

I have a page which loads HTML, it calls jQuery and prettyPhoto. There is some inline JS which makes a JSON request further down the page:

It should work like the below:

1) Page loads,

2) Javascript code run,

3) Script runs a jQuery JSON request which returns and has HTML (a-tags and images inside each a-tag) inside,

4) Script then prints the HTML from inside the JSON to the screen,

5) User clicks a-tag/image and it opens in prettyPhoto’s iframe popup.

NOTE -> Each a-tag has a prettyPhoto id attached (to load the image in prettyPhoto using iframe popup).

The problem is the images (a-links) do not open with prettyPhoto and I am not sure why. There is no JS Error.

However, it does work if i manually have the HTML (a-links/image) already there (so just loading their HTML from the JSON request seems to make the difference).

Seems by time the JSON request returns (with HTML) prettyphoto already binds to a-tags (or lack off).

Tested so far:

Tried putting JSON request in ‘document.ready’ and prettyPhoto in ‘window.load’. So does JSON requests early and prettyPhoto binds when everything else loads – failed

Tried using jQuery AJAX instead of JSON – failed

Dont need the code especially but having trouble with the logic.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T12:09:50+00:00Added an answer on June 17, 2026 at 12:09 pm

    It sounds like the HTML from the JSON (a-links/images) doesnt come back quick enough (before ‘window.load’ runs).

    Try putting the prettyPhoto JS into the success callback (i.e. where returns data).

    Below load_images.json is the JSON request you do which returns the HTML (a-links and their images):

    $.getJSON("load_html.json", function() {
        //grab HTML data (images/a-links) from json file and print into page
    })
    .success(function() { 
        //JS code running prettyPhoto inside here. Now will bind to a-links.
    });
    

    PrettyPhoto now binds to A-links AFTER the JSON has loaded them.

    Hopefully will help having the prettyPhoto stuff AFTER the a-links.

    If that fails try putting the prettyPhoto code inside the complete callback which occurs after success callback. Like the below:

    $.getJSON("load_html.json", function() {
        //grab HTML data (images/a-links) from json file and print into page
    })
    .success(function() { 
        //nothing
    })
    .complete(function() {
         //JS code running prettyPhoto inside here. Now will bind to a-links.
    });
    

    This way you are giving prettyPhoto plenty of time to bind to the correct a-links which are marked for it.

    Try that.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this situation: There are a login page with a login form (form
Having some issue with my function call please. I have a situation that I
Situation: There are several entities in a simulated environment, which has an artificial notion
I have the following situation: There is one custom view inside of the first
There is a situation where I need to have a suspend kind of behavior
I have read the documentation of each function on jQuery official website , but
I have a situation when there's a table and you can add a new
I am having an odd problem with jQuery 1.5.2 in Chrome. I have code
i'm having a bit of a problem. Here's the situation. I have an amount
I'm having situation like 3 select box is there in a form <form> <select

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.