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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T11:42:12+00:00 2026-06-04T11:42:12+00:00

Is it possible to pass the url attribute a dynamical query string? E.g url(

  • 0

Is it possible to pass the url attribute a dynamical query string? E.g url( ./SOME_IMAGE_GENERATOR?image=1 ); where image varies?

I need this attribute to be set via JS:

$( "#elem" )[ 0 ].style.background = "url( ./renders/circuit.php?circuit=" + dirY + dirX + "&dims=1|1 )";

The link in the url points to a file, that generates and returns an image.
The image is generated correctly, but not applied as backround.

Clarification

The image I want to put inside does not exist yet. It is generated and returned by the page circuits.php and depends on the arguments.

The background is well changed, if the image exists. I have noticed that unlike changin the src attribute of the img tag, while the argument creates a request by the browser, sends and recieves headers and info, the background does not.

I’d thought about sending a request to the circuit.php generator, make him save the image on the server and then, with setTimeout, change the background, but I cannot rely on a certain time for the generation.

That is the problem. Now, do you guys have any ideas how to overtake this?

  • 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-04T11:42:14+00:00Added an answer on June 4, 2026 at 11:42 am

    Working Example

    I’ve replicated your scenario with a Jsfiddle and a image generating script held on my own website.

    As you can see it is indeed possible to change the background dynamically with a generated image:
    http://jsfiddle.net/DigitalBiscuits/Eh8yY/6/

    Debugging your code

    So….what’s wrong with yours?
    Well firstly if you’re using Firefox or Chrome, use the developer tools to check what’s going on. Make sure no Javascript errors are showing up in the console.

    Then I would suggest you check that your javascript is actually selecting the element, and that it is able to change the background (lets say to a static image). Isolate the code you that’s giving you problems and test it out in a new empty page, kinda like the JSfiddle I’ve linked you to above.

    On a side note, your javascript code looks a bit foreign to me.

    Instead of:

    $( "#elem" )[ 0 ].style.background = ...
    

    try using:

    document.getElementById('myImg').style.background = ...
    

    Lastly, ensure that you’re setting the correct headers in your php script that generates the images, and that no output is happening before the headers are set.

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

Sidebar

Related Questions

I wanna kn is it possible to pass query string along with URL when
Is it possible to pass through an image file from a remote URL, without
Is it possible to pass url parameters with this type of redirect_to? redirect_to contact_path(@contact),
Is that even possible? what I need to pass to mechanize? With what url
I know that it is possible to pass in parameters via URL to ClickOnce
Is it possible to pass over a string, finding the white spaces? For example
Is it possible to pass the coloumn name also like a variable.Please edit this
Is it possible to pass a URL variable into xsl. EG. http:www.somedomain.com/index.aspx?myVar=test&myVar2=anotherTest I'd like
Is it possible to pass mouse clicks through an overlaying element: <div style=background: url('img/rain.png');
I'm trying to match a URL something like http://example.com/this.is.my.full.hostname/something/else apparently when I pass 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.