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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T17:55:53+00:00 2026-05-17T17:55:53+00:00

What is the most effective way to pass object and category ids or other

  • 0

What is the most effective way to pass object and category ids or other system variables which shouldn’t be presented to the user, from server to the browser?

Let’s say I have a list of items where I can do something with each of them by javascript, for example show tooltip html or add to favorites by ajax, or display on a map. Where is it best to save that tooltip html, or database id, or geoposition?

Some options I can think of are:

  • some dictionary within <script></script> tag for each item,
  • microformats,
  • inline xml,
  • rel attributes,
  • css class names with specific information, e.g. class="lat-12345 uid-45678",
  • one <script></script> with a dictionary of html ids mapping dictionaries with system values in the template,
  • javascript generated from the database and included via <script src="..."></script> with a dictionary of html ids mapping dictionaries with system values in the template,
  • ajax requests for all cases when I need more information than just id,
  • event handlers with parameters within html tags, e.g. onmouseover="tooltip(this, 123, 'Hello world!')".

P.S. I prefer unobtrusive solutions and also the loading/execution time is important.

  • 1 1 Answer
  • 1 View
  • 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-17T17:55:54+00:00Added an answer on May 17, 2026 at 5:55 pm

    Perhaps I am missing something… why not just JSON?

    How you “send” it (either in the initial page load as “javascript” or via AJAX or whatnot) is really just a trivial detail determined mostly by when the data is available. (JSON is a subset of legal JavaScript syntax.)

    Then it’s just a matter of the correct transformation. Of course, by pushing this to JSON/JS, you may render some non-JS clients non-interoperable, if that’s a consideration for you. If such is indeed the case, why not just perform the transformation server-side using well, any number of the techniques you put at top?

    You can also use arbitrary attributes in HTML (the HTML5 spec may include “data-*” which is formally legalized) — while not technically “correct”, all major web-browsers will accept unknown attributes which can be accessed through the DOM API.

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

Sidebar

Related Questions

Which is the most effective way to sum data in the DataTable by a
Hey, what's the most effective way to remove beginning and ending slashes from all
What is the most effective to way to make Catalyst::Plugin::Authentication work if the user
Question: What would be the most effective way of doing a nested list which
I wonder what's the most effective way to render ANYTHING that might come from
What is the best and most effective way to extract a string from a
Simply put: What is the most effective way to share / reuse code between
I hope I'm not duplicating here :-) I'm wondering what's the most effective way
I'm just wondering which method is the most effective if I'm literally just wanting
What is the simplest most effective way to verify that your SQLite db is

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.