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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:55:51+00:00 2026-05-28T05:55:51+00:00

I’d like to be able to set an image source from a server but

  • 0

I’d like to be able to set an image source from a server but also have it return extra data relating to another server-side action.

I’ll try to explain.

In my index.htm file I have the following in the <body> …

<div id="BasicDemo" >
    <img id="nscreen" />
</div>
<script type="text/javascript">setImageSource()</script>

The setImageSource() simply does this…

$("#nscreen").attr("src", "/control?size=800x480");

I’m not an experienced HTML coder but I’m experienced enough at coding in general to understand that the above is an implicit HTTP GET request against server-side code in order to request an image which is used to set the <img> source.

What I’d like to do in psuedo-code is…

var someResponse = getImageAndExtra("/control?size=800x480");
$("#nscreen").attr("src", someResponse.imagePath);
var extraData = someResponse.extra;

I’m not directly in control of the server-side code but I know the developer and will be working on this.

What sort of call can I use to request both an image source as well as extra data and still be able to set the “src” attribute? Also at the other end, how would the server-side code construct the response?

I can’t help feeling I’m missing something really simple here.

  • 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-05-28T05:55:52+00:00Added an answer on May 28, 2026 at 5:55 am

    Your server code would have to return a web page independent of the image.

    This web page would contain the path to the actual image, and then (independently), your additional data.

    One very common format for this type of communication is JSON. The server constructs a page which looks like this:

    {extra: "some-data", image: "/path/to/real/image"}
    

    Just that, no HTML, and it sets the Content-Type of the response to application/x-json instead of text/html.

    Then the JS does an XMLHTTPRequest to fetch the above JSON, parses the response, and then sets the src attribute.

    There is no location to which you could set the image source which would let you extract additional info (barring image steganography or header tricks or other dirty dealings).

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have some data like this: 1 2 3 4 5 9 2 6
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a French site that I want to parse, but am running into
I have a text area in my form which accepts all possible characters from
I want to construct a data frame in an Rcpp function, but when I
I have a bunch of posts stored in text files formatted in yaml/textile (from
I would like to count the length of a string with PHP. The string
I want to count how many characters a certain string has in PHP, but
link Im having trouble converting the html entites into html characters, (&# 8217;) i

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.