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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:47:06+00:00 2026-06-13T23:47:06+00:00

We had a utility js function that was included in several js files in

  • 0

We had a “utility” js function that was included in several js files in our site, so to reduce code repetition we moved it to a utilities file and modified all the js files to load it before using it with getScript. This worked in most cases, but with one piece of code that uses livequery I’m getting errors.

The code that I am using successfully wherever we need to use the new function:

$.getScript("js/utilities.js", function(){
   ... use parseQueryString function ....
});

Code before:

$('.preview')
    .livequery(function(){
            $(this).attr('rel','myPage.cfm?' + parseQueryString($(this).attr('rel')));
        });

Basically, whenever an element with a class of “preview” shows up on the scene, we want to parse the rel attribute and replace it with the newly parsed string.

Code after:

$('.preview')
    .livequery(function(){
            var preview = $(this);
            // load utilities.js so that we can access the parseQueryString function
            $.getScript("js/utilities.js", function(){
                preview.attr('rel','myPage.cfm?' + parseQueryString(preview.attr('rel')));
            });
        })

The problem is, this seems to be continuing to the next iteration of the $('.preview').livequery loop before executing the callback of the getScript call. So the preview variable gets reset before we can replace its rel attribute with the appropriate value. How can I get this to execute correctly?

  • 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-13T23:47:08+00:00Added an answer on June 13, 2026 at 11:47 pm

    A work-around I just came up with that seems to be working… Put the getScript call around the livequery loop:

     // load utilities.js so that we can access the parseQueryString function
    $.getScript("js/utilities.js", function(){
        $('.preview')
            .livequery(function(){
                $(this).attr('rel','myPage.cfm?' + parseQueryString($(this).attr('rel')));
            })
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a smallish utility library I made that I had created in TFS
I had an app called GrabUrTime, it's a timetable viewing utility that get its
I need a conversion utility/script that will convert a .sql dump file generated on
I currently have the following code: function render(url1, url2, message) { utility.messageBoxOpen(message); $.getJSON(url1, function
I've had this problem with several different C# apps. These are all utility programs
I have a utility function that enumerates all values of a type that is
I had a requirement to create a small file utility class to run off
At one point I had a nice little compression utility that smashed my Delphi
I had written a small utility app just for my phone, which stopped the
I am learning C# and WPF and had an idea for a little utility.

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.