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

  • Home
  • SEARCH
  • 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 6017379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:07:12+00:00 2026-05-23T03:07:12+00:00

I am populating a Dojo Combobox dropdown with values from JSON. The code below

  • 0

I am populating a Dojo Combobox dropdown with values from JSON.
The code below works just fine (inline JSON)…..

<script>
var magicvars = {
   identifier: 'name',
   label: 'name',
   items: [
   {name: "ZCCN_NO_1", label: "<img width='16px' height='16px' src='http://localhost:3000/static/images/eight_ball_16x16.png'/>ACCN_NO_1"},
   {name: "CR_Local_ID", label:"<img width='16px' height='16px' src='http://localhost:3000/static/images/eight_ball_16x16.png'/>CR_Local_ID"}
]};
</script>

<div dojoType="dojo.data.ItemFileReadStore" data="magicvars" jsId="xvarStore2"></div>

However when I specify an external file for the JSON, no go, which is to say that the dropdown populates.
The external file is standard.txt and looks like this…

{
  identifier: 'name',
  label: 'name',
  items: [
  {name: "ZCCN_NO_1", label: "<img width='16px' height='16px' src='http://localhost:3000/static/images/eight_ball_16x16.png'/>ACCN_NO_1"},
  {name: "CR_Local_ID", label:"<img width='16px' height='16px' src='http://localhost:3000/static/images/eight_ball_16x16.png'/>CR_Local_ID"}
 ]};

My HTML call to dojo the looks like this..

<div dojoType="dojo.data.ItemFileReadStore" jsId="xvarStore2" url="http://localhost:3000/static/standard.txt">
</div>

Inline works fine but the external call does not. Apologies if this is a remedial question but how can I read the external file and assign it to “magicvars”. I just don’t want to clutter up the HTML with a bunch of inline JSON.

Any advice is appreciated.
Janie

  • 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-23T03:07:13+00:00Added an answer on May 23, 2026 at 3:07 am

    It’s not valid JSON, so will not parse with most JSON.parse implementations. Try quoting the key names and getting rid of the trailing semicolon.

    On Chrome,

    JSON.parse('{ a: "b" }')
    

    produces

    SyntaxError: Unexpected token ILLEGAL
    

    as does

    JSON.parse('{ a: "b" };')
    

    but with valid JSON (note the quotes around "a")

    JSON.parse('{ "a": "b" }')
    

    returns the expected result.

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

Sidebar

Related Questions

I am having a listbox in ASP.net. I am populating the listbox values from
I'm populating a datagrid using Linq--standard kind of stuff (code below). For some reason
Im populating a GridView from List so am forced to use TemplateField controls to
I'm populating an Excel sheet from DTS. The result is formatted as text since
I am populating the customer object as shown below. How do I would I
I am populating combo box from database. In debug i can see that the
Following the Android sample for populating a ListView , I query an array from
I'm populating an anonymous object from an XML file. Up until now, commentary.Elements(Commentator) has
I'm populating a textarea with previous input of a user. This is pulled from
I am dynamically populating a winforms combo box by creating a list from a

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.