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 8798343
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T00:04:38+00:00 2026-06-14T00:04:38+00:00

I have a loading gif for the gallery on my website. In my js

  • 0

I have a loading gif for the gallery on my website. In my js file I have this code to show the loader:

image: $("<img src='images/loading.gif'/>"),

Currently this the image isn’t appearing because I haven’t put the full image path. But instead of putting the full image path, I would prefer to do this:

<img src="<?php bloginfo('url');?>/images/loading.gif”>

But I can’t work out how to make this php work in my js file. How do I go about doing it in the easiest way?

  • 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-14T00:04:40+00:00Added an answer on June 14, 2026 at 12:04 am

    I prefer to..

    1) In my header include (the php include that contains any <head> data), write a small
    inline JS function that creates a global object containing any variables I need from the server (PHP). I can use the ‘echo’ and ‘json_encode’ functions here because its in an inline JS snippet in a php file.

    2) You could write a JS function inside your JS file that uses AJAX to call a PHP file, which will return the same JSON encoded data as number 1, then you parse it and assign in to a global variable.

    Both essentially do the same thing, except with 2 you are using AJAX, which will add an additional request. I prefer option 1, because it is done along with the pages execution. Option 2 may require you to wait until the DOM is ready, depending on various aspects of your program (in which I can not tell).

    Option 1 requires inline JS, but you really shouldn’t harp on this, as with dynamic websites it can actually be a plus, as along as it is short and concise. Some people get on others about inline JS. Don’t let them yell at you.

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

Sidebar

Related Questions

I have this jquery code: $('#fr_tab').click(function() { $(#tab2).empty().html('<img src=images/loading.gif />'); var handle = setInterval(function
i'm using this to delay the loading of my images: HTML: <img src=loading.gif delayedSrc=url/to/real/image.png
I have the following loading image: <img id=loading src=loading.gif /> To show/hide it during
<div id=dialog><img src=images/load.gif/></div> I have this gif that plays before document.ready , and i'm
i have image tag which has id attribute. I want to show this loading
I have following code for loading image from url in xml parsing endElement method
kindly have a look at this code: $('a.load').click(function(){ setTimeout(function(){ $(.content_container).append('<div class=preloading><img src=http://localhost:8888/smart/assets/images/loading.gif alt=loading /></div>').show();
I have the following HTML: <input class=button name=save onclick=$(this).replaceWith('<img src=http://www.example.com/images/ajax-loader.gif />'); type=submit value=SUBMIT> When
I have a gallery in my website. The gallery contains 15 images, each one
I have a loading image that works using the code below. It shows the

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.