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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T23:24:03+00:00 2026-06-07T23:24:03+00:00

I have a jQuery plugin that someone helped me write. I originally only needed

  • 0

I have a jQuery plugin that someone helped me write. I originally only needed it for one use so hardcoded the textbox value lookup directly in the plugin, but now I would like to pass that variable in from where I call it so I can reuse the same plugin multiple times.

Here is what I have, I will post both plugins so you will see what I have done to get it to work side by side. I would like to pass in the UserSearch: variable instead of hard coding it.

(function ($) {
$.checkMultipleUsers = (function (my) {
    my.CheckUsers = function () {
            return $.ajax({
                type: "POST",
                url: "http://localhost:52350/FabRouting/Webservice/UserList.asmx/GetUserCount",
                data: JSON.stringify({ UserSearch: $("[id$=txtSubmittedBy]").val() }),
                contentType: "application/json; charset=utf-8",
                dataType: "json",
            });
    };
    return my;
})({});
})(jQuery);

and

(function ($) {
$.checkMultipleUsers2 = (function (my) {
    my.CheckUsers2 = function () {

        return $.ajax({
            type: "POST",
            url: "http://localhost:52350/FabRouting/Webservice/UserList.asmx/GetUserCount",
            data: JSON.stringify({ UserSearch: $("[id$=txtOther]").val() }),
            contentType: "application/json; charset=utf-8",
            dataType: "json",
        });

    };
    return my;
})({});
})(jQuery); 

And I call it like this:

promise = $.checkMultipleUsers.CheckUsers();
                    promise.success(function (count) {
}

and

promise2 = $.checkMultipleUsers2.CheckUsers2();
                    promise2.success(function (count) {
}

Also, while I have posted this plugin, is it written well? I don’t understand why it needs both the checkMultipleUsers and the CheckUsers. It seems like it is a function embedded in another function and I don’t understand why.

  • 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-07T23:24:06+00:00Added an answer on June 7, 2026 at 11:24 pm

    This isn’t really a jQuery plugin, this can be done with just a normal function.

    function CheckUsers(searchValue){
            return $.ajax({
                type: "POST",
                url: "http://localhost:52350/FabRouting/Webservice/UserList.asmx/GetUserCount",
                data: JSON.stringify({ UserSearch: searchValue}),
                contentType: "application/json; charset=utf-8",
                dataType: "json"
            });
    }
    

    Then you can just call it like CheckUsers($('#myInput').val());

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

Sidebar

Related Questions

I have a small jQuery plugin that I use for form AJAX validation. There
does jquery have any plugin that prevents entering any input to a textbox that
I have a jQuery plugin that moves an element on the screen, but has
I have a function called Colorbox (jQuery plugin) that takes a number of parameters
I have been trying to make this to be a little jQuery plugin that
I have the data table from the jquery plugin dataTables (http://datatables.net/) that I want
Does jQuery validation plugin have some dependencies? For example, I saw blogposts that said
Using the jquery metadata plugin, I have an element on my page that looks
I have a modal dialog plugin written in jquery, that binds to the click
I've recently added the JQuery autocomplete plug in and have a textbox that autocompletes

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.