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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T22:53:54+00:00 2026-06-10T22:53:54+00:00

I have a problem with creating a tool that’s provides a custom overlay on

  • 0

I have a problem with creating a tool that’s provides a custom overlay on a page via a code generation plugin that is grabbed from the server once the user clicks a bookmarklet on an external site.

When calling $.getScript inside the bookmarklet, the bookmarklet gets the script successfully and starts executing the callback function. Everything is working until I start accessing the plugin itself to start generating the HTML. However, once the plugin method is called, I am unable to receive anything from console, and the overlay fails to appear.

Plugin structure (source for methods themselves omitted as it’s a company project – unfortunate, I’m aware, but sadly necessary).:

(function(jQuery){

    var methods = {
        generateHeader : function () {

        },
        generateItem : function(arguments) {

        },
        generateGridList : function(arguments) {

        },
        hideOverlay : function(){

        }
    }

    jQuery.fn.generator = function(method) {
        console.log("generator reached"); //Doesn't print.
        if(methods[method]){
            return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
        } else if (typeof method[method] === 'object' || !method){
            return methods.init.apply(this, arguments);
        } else {
            $.error('Method ' + method + ' does not exist on jQuery.generator');
        }
    };

})( jQuery );

And my relevant bookmarklet contents:

$.getScript(<scriptURL>, function() {

    //generate data to send to server   

    //send unordered lists to server for processing
    $.ajax({
        requestType:'GET',
        url: <url>,
        dataType: 'jsonp',
        jsonp: 'callback',
        success: function(returnedData){
            //success param inside as data is required to proceed.
            $.each(returnedData.data, function(i, val){
                var htmlToAdd,
                content;

                console.log(val); //succeeeds, not null.

                htmlToAdd = $.generator('generateItem', val);

                console.log(htmlToAdd); //fails to reach log at this point

                //code to append to page
            });
        }
    });
});

All the methods do is generate HTML and CSS based on $.css and $(), var.append() and var.html() functions, and a couple of hide/remove functions to clear it on exit.

It’s late here (close to 9:30pm as of posting) and I’m losing concentration, so I’ll be double checking the methods when I arrive in the office tomorrow morning, I just wanted clarification on any pitfalls this approach has, or if I have any glaring mistakes in my AJAX request, my use of getScript() or my plugin structure. If I know it’s likely to be a method based issue, that narrows my search and allows for a potential rewrite of certain functions.

Thanks in advance,

Craig Domville.

  • 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-10T22:53:56+00:00Added an answer on June 10, 2026 at 10:53 pm

    I just wanted clarification on any pitfalls this approach has, or if I have any glaring mistakes in my AJAX request, my use of getScript() or my plugin structure.

    I see nothing wrong with your basic approach.

    Some things to consider: Before you use $.generator(...), add console.log($.generator) and see if it returns the function code you expect. Don’t assume that just because getScript callback fired, that script was executed properly. You seem to assume that $ == jQuery; maybe that is a safe assumption, maybe not.

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

Sidebar

Related Questions

I have the following problem: I am creating a simple plugin jquery carousel, to
I have problem creating new instance of excel 2007 using VBA (from Access 2002).
I have problem with creating a simple MySQL trigger in C#. I'm using StringBuilder
I have a problem creating a std::map<int, int> from a vector of pointers, called
I have a problem creating the following SQL Statement using LINQ & C# select
I have a problem creating and executing a JAR file. I have already made
I have encountered a problem with creating a thumbnail from an uploaded image file,
I am creating an insert process in php but I have a problem in
I have a problem: (I wouldn't be here otherwise ;) I am creating an
I am working on creating website with Yii framework and I have a problem

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.