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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T06:36:52+00:00 2026-06-18T06:36:52+00:00

I am developing a wordpress theme and I have a contact form that uses

  • 0

I am developing a wordpress theme and I have a contact form that uses jquery to check for errors and then show a confirmation message if the email was sent successfully.

Before the confirmation email is shown, I want to show a loading.gif so the user knows it is doing something. My problem is assigning the img SRC url in jquery, as I do not want it to be fixed.

I want to set it to get the site url and then add the image name to it.

As you cannot parse PHP in js I thought that maybe I could cheat and do the PHP on the form page using a hidden input that passes the data to JS.

So i’d have a

<li class="hiddenurl">
    <input name="hiddenurl" value="<?php bloginfo('url'); ?>">
</li>

and then in jquery i’d set the value to a variable and then in JS:

$(this).parent().append('<img src="'+variable+'/library/images/loading.gif" etc

Is this a bad way of doing it?

  • 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-18T06:36:53+00:00Added an answer on June 18, 2026 at 6:36 am

    As you cannot parse PHP in js

    Wrong.

    <script type="text/javascript">
        var myvar = <?php echo json_encode($some_php_variable); ?>;
    </script>
    

    json_encode makes any PHP variable (except Resources) instantly parseable by JavaScript. It’s sort of like var_export but for use in JavaScript instead of PHP.

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

Sidebar

Related Questions

While developing my WordPress application i have a requirement where i need to show
I am developing a theme for wordpress. And I have many images in 'images'
I'm new to wordpress and currently developing a theme on it. I have noticed
I am developing a Wordpress theme. In one page I have to use iframe
I have an issue with a custom WordPress theme I'm developing. It's a bit
I'm developing an application using Wordpress as a CMS. I have a form with
I'm setting up a check for IE in a wordpress theme I am developing.
I am currently developing my own Wordpress theme and have been recently working on
I am developing my first wordpress theme and I have a doubt. how to
quick question: i'm developing a wordpress theme for a client and have a heavy

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.