Note that there are some explanatory texts on larger screens.

plurals
  1. POjqplot not evaluating string
    primarykey
    data
    text
    <p>I am using jqplot and have constructed an array with the following PHP code</p> <pre><code>if($fiveRes){ $lastNum = mysql_num_rows($fiveRes); $testarray = array(); while($row = mysql_fetch_array($fiveRes, MYSQL_ASSOC)) { $testarray[] = array($row['GameDate'], floatval($row['WKP'])); } echo json_encode($testarray); } </code></pre> <p>This code outputs the correct code that I need to insert into the jqplot function. Here is the array generated by the code above:</p> <pre><code>[["2011-12-24",0],["2011-12-19",14],["2011-12-08",22],["2011-12-04",14],["2011-11-27",12]] </code></pre> <p>So currently i'm printing this array to the screen, and then using jQuery .text() to capture the string and place it inside a variable. I can echo out the var that I assigned the array string to and it works correctly, however when I pass it into the jqplot function it does nothing.</p> <pre><code>var p1array = $('.col.first .parray').text(); alert(p1array); //Alerts the correct array formatted like above. var plot1 = $.jqplot('jqplot0', [p1array], { title:'Last 5 Fantasy Points', axes:{ xaxis:{ renderer:$.jqplot.DateAxisRenderer, tickOptions:{ formatString:'%b&amp;nbsp;%#d' } }, yaxis:{ tickOptions:{ formatString:'' } } }, highlighter: { show: true, sizeAdjust: 7.5 }, cursor: { show: false } }); </code></pre> <p>To make it even more complicated, if I copy the string that the PHP generates and I hardcode it into a variable in JS it works. Any ideas why the jqplot plugin won't evaluate the string I get from using <code>$(this).text();</code>.</p> <p>Here is the jQplot example i'm modeling after: <a href="http://www.jqplot.com/tests/cursor-highlighter.php" rel="nofollow">http://www.jqplot.com/tests/cursor-highlighter.php</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload