Search Results

Search found 12457 results on 499 pages for 'variable assignment'.

Page 6/499 | < Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >

  • Variable scoping and the jQuery.getJSON() method

    - by jerome
    The jQuery.getJSON() method seems to ignore the normal rules of scoping within JavaScript. Given code such as this... someObject = { someMethod: function(){ var foo; $.getJSON('http://www.somewhere.com/some_resource', function(data){ foo = data.bar; }); alert(foo); // undefined } } someObject.someMethod(); Is there a best practice for accessing the value of the variable outside of the getJSON scope?

    Read the article

  • Problems with umlauts in python appdata environvent variable

    - by Heike
    Hi, I can't find a correct way to get the environment variable for the appdata path in python. The problem is that my user name includes special characters (the german ae and ue). I made a workaround wit PyQt for Vista and Windows 7 but it doesn't work for XP Systems. Does anybody know the correct encoding of these environment variables or another solution for this problem? Greetz

    Read the article

  • anonymous function variable scope [js, ajax]

    - by arthurprs
    $(".delete").click( function() { var thesender = this; $(thesender).text("Del..."); $.getJSON("ajax.php", {}, function(data) { if (data["result"]) $(thesender).remove(); // variable defined outside else alert('Error!'); } ); return false; } ); This can cause problems if user clicks on another ".delete" before the ajax callback is called?

    Read the article

  • Sql - tablename as variable

    - by BhejaFry
    Hi folks, i am trying to execute this query: declare @tablename varchar(50) set @tablename = 'test' select * from @tablename This produces the following error: Msg 1087, Level 16, State 1, Line 5 Must declare the table variable "@tablename". What's the right way to have table name populated dynamically? TIA

    Read the article

  • Changing a Variable Out of Scope?

    - by Matrym
    Is there any way to change a variable while out of scope? I know in general, you cannot, but I'm wondering if there are any tricks or overrides. For example, is there any way to make the following work: function blah(){ var a = 1 } a = 2; alert(blah());

    Read the article

  • PHP echo text if variable is blank

    - by user342391
    I am trying to echo €00.00 if my variable $amount equals zero I have done something wrong can you help?? Code while ($row9 = mysql_fetch_array($result9)) { $amount = $row9['amount']; } //$amount = $amount / 60; //$amount = round($amount, 2); if $amount == 0 echo "<b>Balance: &#8364;00.00</b>"; else echo "<b>Balance: $$amount</b>";

    Read the article

  • Quarter as a Count variable in SAS.

    - by John
    Hye Guys, I'm busy working on a time series and am trying to find the commands that allow me to insert a quarter count variable. To keep things simple, the third quarter of 1995 (date my observations start) should be quarter -2, the fourth quarter of 1995 should be -1 etc etc uptill 2006 (should be somewhere around 45 by then). My dates are in date9 format, such as 20JUN04 etc.. Anyone who can help me with the commands I need t o let this work in SAS? Thanks

    Read the article

  • Giving my function access to outside variable

    - by brett
    I have an array outside: $myArr = array(); I would like to give my function access to the array outside it so it can add values to it function someFuntion(){ $myVal = //some processing here to determine value of $myVal $myArr[] = $myVal; } How do I give the function the right scoping to the variable?

    Read the article

  • jQuery global variable problem

    - by Emanuel
    var id = $(this).children().html(); // id is 5 $.ajax({ url: 'ajax.php?id=' + id, success: function(data) { id = data; // id is 1 } }); if(id == 1){ // id is again 5 ... } Why in the following example I can't reinitialize the id variable? What is wrong? Thanks.

    Read the article

  • getJSON and variable scope in javascript

    - by nillls
    Hi! In order to make function calls to our back-end php code we've implemented something called an ActionProxy like this: function ActionProxy(action, input, callback){ $.post("ActionProxy.php?method="+action, { data: input}, function(data, textStatus, XMLHttpRequest){ //return data.ResponseWhatever } }); The problem we're having is that using data outside the ActionProxy is impossible due to variable scope limitations (we assume), setting var res = data.ResponseWhatever or return data.ResponseWhatever is pretty futile. How would one handle these responses most appropriately so that functions calling the actionproxy can access the response values?

    Read the article

  • can't find variable: $j

    - by orangebrainer
    Ahh i'm stuck again. helpp why do i encounter this "can't find variable: $j" when i use this method function myMethod(htmlObject) { var buttonTags = $j("button",htmlObject); ... } Sorry for askin silly questions again. running outta time =\ THANKS FOR THEHELP!

    Read the article

  • JavaScript variable to ColdFusion variable

    - by Alexander
    I have a tricky one. By means of a <cfoutput query="…"> I list some records in the page from a SQL Server database. By the end of each line viewing I try to add this in to a record in a MySQL database. As you see is simple, because I can use the exact variables from the output query in to my new INSERT INTO statement. BUT: the rsPick.name comes from a database with a different character set and the only way to get it right into my new database is to read it from the web page and not from the value came in the output query. So I read this value with that little JavaScript I made and put it in the myValue variable and then I want ColdFusion to read that variable in order to place it in my SQL statement. <cfoutput query="rsPick"> <tr> <td>#rsPick.ABBREVIATION#</td> <td id="square"> #rsPick.name# </td> <td>#rsPick.Composition#</td> <td> Transaction done... <script type="text/javascript"> var myvalue = document.getElementById("square").innerHTML </script> </td> <cfquery datasource="#Request.Order#"> INSERT INTO products (iniid, abbreviation, clsid, cllid, dfsid, dflid, szsid, szlid, gross, retail, netvaluebc, composition, name) VALUES ( #rsPick.ID#, '#rsPick.ABBREVIATION#', #rsPick.CLSID#, #rsPick.CLLID#, #rsPick.DFSID#, #rsPick.DFLID#, #rsPick.SZSID#, #rsPick.SZLID#, #rsPick.GROSSPRICE#, #rsPick.RETAILPRICE#, #rsPick.NETVALUEBC#, '#rsPick.COMPOSITION#','#MYVALUE#' ) </cfquery> </tr> </cfoutput>

    Read the article

  • What is meant by Scope of a variable?

    - by Appy
    I think of the scope of a variable as - "The scope of a particular variable is the range within a program's source code in which that variable is recognized by the compiler". That statement is from "Scope and Lifetime of Variables in C++", which I read many months ago. Recently I came across this in LeMoyne-Owen College courses: What exactly is the difference between the scope of variables in C# and (C99, C++, Java) when However a variable still must be declared before it can be used

    Read the article

  • non-static variable cannot be referenced from a static context (java)

    - by Greg
    I ask that you ignore all logic.. i was taught poorly at first and so i still dont understand everything about static crap and its killing me. My error is with every single variable that i declare then try to use later inside my methods... i get the non-static variable cannot~~ error I can simply put all the rough coding of my methods inside my cases, and it works but then i cannot use recursion... What i really need is someone to help on the syntax and point me on the right direction of how to have my methods recognize my variables at the top... like compareCount etc thanks public class MyProgram7 { public static void main (String[]args) throws IOException{ Scanner scan = new Scanner(System.in); int compareCount = 0; int low = 0; int high = 0; int mid = 0; int key = 0; Scanner temp; int[]list; String menu, outputString; int option = 1; boolean found = false; // Prompt the user to select an option menu = "\n\t1 Reads file" + "\n\t2 Finds a specific number in the list" + "\n\t3 Prints how many comparisons were needed" + "\n\t0 Quit\n\n\n"; System.out.println(menu); System.out.print("\tEnter your selection: "); option = scan.nextInt(); // Keep reading data until the user enters 0 while (option != 0) { switch (option) { case 1: readFile(); break; case 2: findKey(list,low,high,key); break; case 3: printCount(); break; default: outputString = "\nInvalid Selection\n"; System.out.println(outputString); break; }//end of switch System.out.println(menu); System.out.print("\tEnter your selection: "); option = scan.nextInt(); }//end of while }//end of main public static void readFile() { int i = 0; temp = new Scanner(new File("CS1302_Data7_2010.txt")); while(temp.hasNext()) { list[i]= temp.nextInt(); i++; }//end of while temp.close(); System.out.println("File Found..."); }//end of readFile() public static void findKey() { while(found!=true) { while(key < 100 || key > 999) { System.out.println("Please enter the number you would like to search for? ie 350: "); key = scan.nextInt(); }//end of inside while //base if (low <= high) { mid = ((low+high)/2); if (key == list[mid]) { found = true; compareCount++; }//end of inside if }//end of outside if else if (key < list[mid]) { compareCount++; high = mid-1; findKey(list,low,high,key); }//end of else if else { compareCount++; low = mid+1; findKey(list,low,high,key); }//end of else }//end of outside while }//end of findKey() public static void printCount() { System.out.println("Total number of comparisons is: " + compareCount); }//end of printCount }//end of class

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >