473,385 Members | 1,753 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How to determine '+ variable +' in var url string?

Hello,

I am trying to determine what the appropriate variable is to place between plus (+) tags in in a javascript var url string. For instance I have the following code:

Expand|Select|Wrap|Line Numbers
  1. <script>
  2.    function refreshData() {
  3.    var url = "/pulldata.php?p=" + tags + "&s=" + statistic + "";
  4.  
  5. // rest of js
  6. </script>
  7.  
Essentially, what is the definition of + tags + and + statistic + and how do you determine what variables they are supposed to be?
Oct 19 '10 #1
2 1742
Dormilich
8,658 Expert Mod 8TB
tags and statistic seem to be 2 global variables.
Oct 19 '10 #2
How would I define the global variable for $statistic_id from this bit of code:

Expand|Select|Wrap|Line Numbers
  1. <div id="playerstats">
  2. <table width="265px" border="0" >
  3. <? $i = 0; foreach ($combine as $statistic_id => $stat_values): ?>
  4. <tr>
  5. <td style="vertical-align:middle; font-size : 11px;">
  6.   <input type="checkbox"  id="checkbox_<?= $statistic_id; ?>" <?= $i==0 ? 'checked="checked"' : null; ?> />
  7.   <label for="checkbox_<?= $statistic_id; ?>"><?= getStatisticFromId ( $statistic_id ); ?></label>
  8. </td>
  9. </tr>
  10. <? $i++; endforeach; ?>
  11. </table>
  12. <script>
  13. </div>
  14.  
$statistic_id is a variable number that is associated with the checkbox. When someone clicks a new checkbox they are effectively selecting a new $statistic_id. I need to define $statistic_id as a global variable so that I can incorporate it into my AJAX. Please see this code below:

Expand|Select|Wrap|Line Numbers
  1.  function refreshData() {
  2.    var pid = <?= $_GET['p']; ?>;
  3.    var statistic_id = ???;
  4.    var url = "/pulldata.php?p=" + pid + "&s=" + statistic_id + "";
  5.    $.getJSON( url,
  6.    function(data){
  7.      for ( pid in data ) {
  8.        for ( statistic_id in data[ pid ] ) {
  9.          console.log( data[ pid ][ statistic_id ] );
  10.          drawLineOnGraph( data[ pid ][ statistic_id ] );
  11.       }
  12.     }
  13.    } );
  14.   }
  15.  
If you know of a way to make $statistic_id a global variable that I can incorporate into my AJAX that would be helpful. Thanks.
Oct 19 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: MCollins | last post by:
trying to determine a variable type, specifically that a variable is an integer. i tried using type(var) but that only seemed to produce a response in the command line. is there a built in...
1
by: Randy K | last post by:
I have a table with some 35000 records and I need some help sorting it out. The goal is to get counts of failures modes oraganized by serial number. the table is set up roughly like this. s/n ...
15
by: Ramaraj M Bijur | last post by:
Hi All, Could anyone help me to resolve following problem in C the IDE used is Microsoft VC++, Please let me know the which option in VC++ will do the needful The problem statement:...
6
by: lisa.lin | last post by:
Hi,all Is there any library function to tell a string to be a number? I did't find it in <string.h>, does anyone kow? Thanks in advance! Lisa Lin
2
by: charliefortune | last post by:
I have three drop down menus that when changed call a simple js function, passing a value i.e. <SELECT name="Team" onChange="change('national');"> the function defined at the beginning is ...
4
by: Gustavo Arriola | last post by:
Hello to all! I am trying to accede to a method of a class invoking(the class) from a variable string. The class is in other assembly called "infoInsumo" The code: Dim Tipo As Type =...
1
by: amiben | last post by:
Hi everyone. I have an .asp file that is included in my sites pages which holds information in a string array. The array is so large that the include file is almost 900kb in size. Some array...
6
by: lcottrell | last post by:
I'll start off by saying I'm not very experienced in writing SQL commands. I am familiar with vbscript though, and I can do a similar thing in that, but can't seem to get it to work in SQL. What I...
7
by: codinginc | last post by:
Hi Everyone, Is it possible to insert format specifier in a form of variable. See example below Standard from char result; float fnum = 3.14159; sprintf( result, "%f", fnum );...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.