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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T18:41:39+00:00 2026-06-11T18:41:39+00:00

I am attempting to create a glossary tooltip for a website that finds keywords

  • 0

I am attempting to create a glossary tooltip for a website that finds keywords from a json file that is being created by sitecore. I need to get the “Text:” parts from the json file and make then a variable in my jquery so they are the keywords that are found and wrapped with the appropriate tags. I had it working to the point where i could get console to log that there were 2 entries in my json file but that’s it.

Here is my sample json code:

[{"Id":"ef339eaa-78e1-4f9e-911e- 096a1920f0b6","Name":"Glossary","DisplayName":"Glossary","TemplateId":"b27d2588-3d02-4f5f-8064-2ee3b7b8eb39","TemplateName":"Glossary","Url":"/Global-Content/Glossary/Glossary","Version":1,"Created":"\/Date(1343987220000)\/","CreatedBy":"sitecore\\rgoodman","Revision":"ae8b3ae0-d0ca-4c4a-9f27-a542a31ab233","Updated":"\/Date(1348137810133)\/","UpdatedBy":"sitecore\\admin","Text":"Glossary","Content":"A bit of test content for the glossary"},{"Id":"3fa51ad4-cfb6-4ff1-a9b5-5276914b2c23","Name":"Abraham","DisplayName":"Abraham","TemplateId":"b27d2588-3d02-4f5f-8064-2ee3b7b8eb39","TemplateName":"Glossary","Url":"/Global-Content/Glossary/A/Abraham","Version":1,"Created":"\/Date(1348148640000)\/","CreatedBy":"sitecore\\admin","Revision":"231284ec-9fb9-4502-ad79-a5806479ecba","Updated":"\/Date(1348148779656)\/","UpdatedBy":"sitecore\\admin","Text":"Abraham","Content":"This is a lincoln person"}]

But I suppose this is not of any use as it is just the “Text:” part i am looking to return.

Here is my jquery:

function getData(url) {
var data;
    $.ajax({
        async: false,
        url: '/_assets/js/glossary.json',
        dataType: 'json',
        success: function(data.Text){
           data.Text = response;
        }
        return(response);
    });
}


function HighlightKeywords(keywords)
{         
var el = $("body");
$(keywords).each(function()
{
    var pattern = new RegExp("(" +this+ ")", ["gi"]);
    var rs = "<mark href='#' class='tooltip'>$1</mark>";
    el.html(el.html().replace(pattern, rs));
});
}        

HighlightKeywords(data.Text);

Essentially i need to return the “Text:” bit of json where data is on the HighlightKerywords function. Where am i going wrong?

Any help would be much appreciated. 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-11T18:41:40+00:00Added an answer on June 11, 2026 at 6:41 pm

    Ajax is Asynchronous communication, you can’t insert its response into a global variable and expect to be able to work with it.

    You need to do all the work on the data.text in the success function.

    success: function(response){
               HighlightKeywords(response.Text);
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am attempting to create a class in vb.net from the below JSON example.
I'm attempting to create a custom control that inherits from System.Web.UI.WebControls.ListView . Codebehind: using
I'm attempting to create an automated bash script that fills up a file with
I'm attempting to create a custom calendar control that inherits from ASP.Net's built in
While attempting to create a replacement tablespace for USER, I accidentally created a datafile
I am attempting to create a report, utilizing a matrix, that only displays columns
I'm attempting to create a single Controller class to handle all foreseeable surveys that
I'm attempting to create a Parcelable class in Android so that I can pass
I am attempting to create an inbound Mule endpoint that will receive Syslog messages
Attempting to create an itemgroup for use in a target where the file types

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.