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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T05:44:33+00:00 2026-06-18T05:44:33+00:00

So the basic rundown is that I’m trying to create a rudimentary means of

  • 0

So the basic rundown is that I’m trying to create a rudimentary means of flagging inappropriate content on our web mapping application.
Within a function that dynamically creates content for the sidebar of the webmap when the user clicks on a point I have this piece of code that should generate an image of a flag.

When the user clicks the flag, I want to run the function flagContent which should pass a url string into the function. From within this function I would then be able to
write it to a database later on (though I haven’t made it this far yet).

Here are some code snippets I have been working with.:

1.This is where the flag image is generated

content += "<p class='info'><img id='flag' onclick='flagContent(" + attachmentInfo.url + ")
'src='assets/flag.png' style='height:15px'>Flag as inappropriate...</p>";
  1. This is the connected function

    function flagContent(imageUrl){ console.log(imageUrl)}

So basically the url is a string and I’d like to be able to manipulate it within the flagContent function. Unfortunately I can’t get it to work. When I pass a numerical parameter such as attachmentInfo.objectID I do not run into the same problem.

For what it’s worth I also get this error:

Uncaught SyntaxError: Unexpected token :

Any help would be greatly appreciated. Let me know if there is additional information that could help to solve this. Thanks!

  • 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-18T05:44:34+00:00Added an answer on June 18, 2026 at 5:44 am

    I’m assuming that attachmentInfo.url would return a URL, which should be a string and it just needs to be surrounded by quotes. Since you’ve already used both types of quotes, you will have to escape some quotes.

    content += "<p class='info'>";
    content += "<img id='flag' onclick=\"flagContent('" + attachmentInfo.url + "')\" src='file.png'/>";
    content += "Flag as inappropriate...";
    content += "</p>";
    

    Doing this makes the final out put look like this:

    <p class='info'>
      <img id="flag" onclick="flagContent('http://example.com')" src='file.png'/>
      Flag as inappropriate...
    </p>
    

    The problem you had was that the URL was not surrounded by quotes, and it saw flagContent(http://example.com) and didn’t know what to do with those bare words not in a string.

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

Sidebar

Related Questions

I am trying to develop a very basic console application that will retrieve a
The basic rundown is... 1) My application starts a Java process and manages it.
Basic jQuery question: I am trying to reveal a div that has been marked
Basic problem: We are currently busy developing a C# MVC3 web application, and after
Basic question here - I have many lines of code that look something like:
Basic summary: Working on a game that generates a 15x15 grid for the player
Basic question: Including a page, that contains a component with component id, multiple times
Basic SQL statement question - I have a table (myUsers) that contains the column
I am trying to build a simple abstract Cache class that can enforce methods
basic overview... i have a site setup in iis... - mysite (wwwroot\mysite) under that

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.