I want to pass a variable to a callback function in JavaScript but I haven't found an easy and straightforward way (without using global variables etc). Here's my code:   $(".delete-sign").click(function(event) {     var imgId = this.id;     bootbox.confirm("Are you sure?", function(response) {         if (response == true) {             $.ajax({                 url:'delete_keyframes.php',                 type:"POST",                 data: { id: imgId },                 success:function(){ alert("Deleted keyframe"); }             });             $("#img-div-"+imgId).remove();         }     });      });   I want to pass the imgId variable inside the callback function. What should I do?
How would you explain JavaScript closures to someone with a knowledge of the concepts they consist of (for example functions, variables and the like), but does not understand closures themselves?  I have seen  given on Wikipedia, but unfortunately it did not help.
Pass Blob through ajax to generate a file Double vs. BigDecimal? How can I get my external IP address in a shell script? Assign default keyboard language per-application Is it possible to assign default keyboard language for specific applications? I know that there is an option to always start an application with a default keyboard language but this is not what I want.  I'm looking for something similar to "fixed workspaces" which you can set using CompizConfig (You set Chrome to always open at X1Y1, terminal at X2Y1 etc). Something where I would set Chrome: Czech, terminal: English, Spotify: English, ... I've installed Ubuntu 13.04 two times on my PC. Each on a different partition. I would like to delete the one which I'm not using. How would I do that? How do I show that there exists variational/action principle for a given classical system? We see variational principles coming into play in different places such as Classical Mechanics (Hamilton's principle which gives rise to the Euler-Lagrange equations), Optics (in the form of Fermat's principle) and even General Relativity (we get Einstein's equation from the Einstein-Hilbert action). However, how do we explain this very principle, i.e., more mathematically, I want to ask the following:      If I am given a set of generalized positions and velocities, say, $\{q_{i}, \dot{q}_{i}\}$, which describes a classical system with known dynamics (equations of motion), then, how do I rigorously show that there always exists an action functional $A$, where    $$A ~=~ \int L(q_{i}, \dot{q}_{i})dt,$$    such that $\delta A = 0$ gives the correct equations of motion and trajectory of the system?    I presume historically, the motivation came from Optics: i.e., light rays travel along a path where $S = \int_{A}^{B} n ds$ is minimized (or at least stationary). (Here, $ds$ is the differential element along the path). I don't mind some symplectic geometry talk if that is needed at all. REST Service API executor.executeAsync Call Ends in Failure Function in Sharepoint Hosted App Any Answers Will Help me to Forward and Gain Knowledge in SharePoint Development  While i am Trying to get the list Items Using Rest API Calls in SharePoint Hosted App Using Below Function  function loadingSamples()  {     var JobListName = "RRR Jobs #";     var executor;     // Initialize the RequestExecutor with the app web URL.     executor = new SP.RequestExecutor("/");      //Fetching the choice values from the Job Status Field, to show in the Dropdown field     executor.executeAsync     ({         url: "/_api/web/lists/getbytitle('" + encodeURIComponent(JobListName) + "')/fields/getbytitle('Job Status')?$select=Choices",         method: "GET",         headers: { "Accept": "application/json; odata=verbose" },         success: successHandlerStatus,         error: errorHandler     }); } function successHandlerStatus(data)  {     alert("sucesss") }  function errorHandler(data, errorCode, errorMessage)  {     alert("errorMessage") }   It's always going to error function named errorHandler With  Error Code as -1002 and Error Message as Bad Request and Inside Data -> Body , the Error message is  {     "error":{            "code":"-1,Microsoft.SharePoint.Client.InvalidClientQueryException",         "message":{             "lang":"en-US",             "value":"The expression \"web/lists/getbytitle('DWR Jobs \" is not valid."         }     } }   Note :    This is working code in Sharepoint Hosted App that previously hosted in another Windows server. Now i hosted this App in New windows server,it's successfully hosted but it gives above mentioned Error in Rest Service Call. tcolorbox Spanning Two Columns in {paracol} Environment The paracol environment allows figures to span two columns by using an asterisk in the figure's environment declaration: \begin{figure*} ... \end{figure*}.  I'm not familiar with the guts of why that works, and I was curious to know if there's something analogous for an environment derived from tcolorbox (like \newtcolorbox{NewBox}[1][!htbp]{...float=#1}). That is, in this example, can I get a NewBox that spans both paracol columns the way I wrongly assumed \begin{NewBox*} ... \end{NewBox*} would.  PS The tag below is "parcolumns" because I don't have a high enough reputation to create the tag 'paracol' (in reference to this CTAN package: ) How to capture text from the operating system in a practical and simple way? Sometimes we can't select the text to copy &amp; paste, such as dialog boxes.  Sometimes it's just not practical, such as 100 files inside a folder.  Is there any practical and simple way to capture those text from the system into a text file?  I'd wish to know both in OS X and Windows. Maybe it just can't be done today... How to remove local (untracked) files from the current Git working tree How do you delete untracked local files from your current working tree? How to change material's color in blender game engine? Is an automorphism of the field of real numbers the identity map? Is an automorphism of the field of real numbers $\mathbb{R}$ the identity map? If yes, how can we prove it?  Remark An automorphism of $\mathbb{R}$ may not be continuous. Is there a difference between DataTable.Clear and DataTable.Rows.Clear? When and where can I find the Tower's exotic item vendor (Xur Agent of the Nine)? Why split the  tag when writing it with document.write()? Why do some sites (or advertisers that give clients javascript code) employ a technique of splitting the &lt;script&gt; and/or &lt;/script&gt; tags up within document.write() calls?  I noticed that Amazon does this as well, for example:  &lt;script type='text/javascript'&gt;   if (typeof window['jQuery'] == 'undefined') document.write('&lt;scr'+'ipt type="text/javascript" src="http://z-ecx.images-amazon.com/images/G/01/javascripts/lib/jquery/jquery-1.2.6.pack._V265113567_.js"&gt;&lt;/sc'+'ript&gt;'); &lt;/script&gt; Bell's inequality theorem, along with experimental evidence, shows that we cannot have both realism and locality.  While I don't fully understand it, Leggett's inequality takes this a step further and shows that we can't even have non-local realism theories.  Apparently there are some hidden variable theories that get around this by having measurements be contextual.  I've heard there are even inequalities telling us how much quantum mechanics does or doesn't require contextuality, but I had trouble finding information on this.  This is all confusing to me, and it would be helpful if someone could explain precisely (mathematically?) what is meant by: realism, locality (I assume I understand this one), and contextuality.  What combinations of realism, locality, and contextuality can we rule out using inequality theorems (assuming we have experimental data)? Showing a bijection between the set of ringhomomorphisms $\mathbb{Z}[i] \to R$ and the set of $x \in R$ for which $x^2+1=0$ Can a character in the middle of a move action alter his movement based on a change in his surroundings? For example:      A player (speed 6) moves two squares towards a human bandit (pg. 162 MM) becoming adjacent to him, then proceeds to move around him to the right, provoking an opportunity attack. The bandit hits with his basic melee attack (+4 vs. AC; 1d8+1 damage, and the human bandit shifts 1 square), shifting one square to the left immediately.    This free shift makes it so that the PC would no longer flank the bandit at the END of his move. Can the player adjust his remaining three squares of movement so that he can once again flank the now-shifted bandit, or does he have to stick with his earlier movement designation?  This question boils down to: Is movement counted as you go, or do you say, "I am moving to here, it is within my range, and on the way to my destination 'blah' happens?" Why the pressure of atmosphere doesn't crush you when you e.g. walk outside? Why the pressure of atmosphere doesn't crush you when you e.g. walk outside? I mean the density of air is $1.26 kg/m^3$, so with $100 km$ above us, it exerts much pressure on you when you walk outside. Ubuntu 12.10 "Turn screen off when inactive for: Never" still turns off