1

I have a function like this:

retrieveData();

and then javascript code like this:

var retrieveData = function ()
        {
            function () { $('#updater').show(); }
            $.post('......

This is I think a simple question but how can I pass an argument to the retrieveData function and have it availabe for use in the code following the .post ?

1
  • That's a rather odd style of formatting you got there ... :) Commented Jun 12, 2011 at 18:31

2 Answers 2

2

Simply

var retrieveData = function (a) {
   $.post(...);
   // use `a` here
}

retrieveData("some value");
Sign up to request clarification or add additional context in comments.

Comments

2
var retrieveData = function (answer) {
  $.post('The answer is ' + answer);
}

retrieveData(42);

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.