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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:44:39+00:00 2026-05-29T10:44:39+00:00

hello i want to pass the value of a function to any other function

  • 0

hello i want to pass the value of a function to any other function or make the value of a function global so that it can be called in any other function . but i dnt knw how to do it , tried some codes still no sucess .

here is the function code

function newalbum(val1,loginuser)
{

$.ajax({
type:"GET",
url: 'ajax/album.php?val='+val1+'&& loguser='+loginuser,
success: function(data) {
$("#newalbum1").html(data);
        var ab=$('#ab').val();
        var abc=$('#loginuser').val();
        var action=$('#action').val();

alert(ab);
}
});
}

in this function i want to make the three variables var ab, var abc, var action to be global so that its value can be used in any other function . can any one help?

edit – the value of var ab, var abc, and var action is comming from ajax data that is why i am not able to use those variable directly , it says undefined if i use it directly.

after the varibales value received from ajax in function newalbum . i want to use those varibales inside

 (function( $ ){
 $.fn.Uploadrr = function( options ) {
  • 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-05-29T10:44:40+00:00Added an answer on May 29, 2026 at 10:44 am

    You can declare the variables in the global scope, and remove var before the ab, abc and action variables. Another method is to prefix the variables with window, the global object.

    Method 1:

    var ab, abc, action; // In the global scope
    ...
        ab = ...;        // Inside the function
    

    Method 2:

    window.ab = $('#ab').val(); // Inside the function
    

    Note: Unless you’ve got an extremely good reason for it, you usually should not declare global variables.

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

Sidebar

Related Questions

Hello everyone I am new to blackberry and I want a textfield that scroll
I want to do the equivalent of the following VB in c# Function([class]) hello
I want to compile a "Hello World" MS-DOS exe. Not a program that runs
I want to write a 'Date' class that behaves like a Value Type. for
I want to pass a struct array into a function and I keep getting
I want to read in a textfile and make it a sequence and pass
update: I would like to pass the var value to the server hello, same
First of all, I don't want to use any framework but I am looking
Hello i have an url in my jsp and i want to pass an
Hello I want write my own desktop sharing application in Java. The application should

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.