Jump to content

chasethemetal

Members
  • Content Count

    169
  • Joined

  • Last visited

Everything posted by chasethemetal

  1. Annddd $("div#clickme").click(function () {alert(this.previousSibling);}); alerts [object Text];
  2. Maybe not? I don't know. I just starting to get a grip on js and jquery $("div#clickme").click(function () {alert(document.getElementById("clickme").previousSibling);}); this alerts [object Text]... and $("div#clickme").click(function () {alert(document.this.previousSibling);}); alerts nothing.
  3. Sorry I needed to explain more content1 and clickme are dynamic meaning, there are lot's so I need to grab it in a (this) manner. Thanks for that though!
  4. The reason I have it outside is because I'm using an api that needs the info thats nested and if I have extra info in there it messes it up. But I still need to add some custom info elsewhere on the page on a click function. Now I prefer to use jQuery. I believe I'm onto something with using .parent() some more tweaking and I think I'll have it. Will post my solution, also if someone else has any ideas let me know!
  5. Hey all! I was wondering what the method would be to grab the element above an elements text would be or if its possible? <div id="content1" style="display:none;">Hello World</div><div id="clickme"></div> The reason I need to get the element above's text is I am already getting different information from "clickme"'s child elements... So in other words I can't nest "content1" inside of "clickme" so the whole next() and prev() methods won't work for my application. Thanks so much!
  6. hey all! This might be one for the SQL forum, but maybe not. Anyways I'm selecting from two mysql tables information. mysql_query("SELECT * FROM tbl1 ORDER BY RAND() ", $db) and mysql_query("SELECT * FROM tbl2 ORDER BY RAND() ", $db) Is there anyway to make the random selection order the same on both queries?? Any tips would be appreciated!! Thanks
  7. Interesting. Thank you. I ended up solving my issue, which was that my wget code was a little broken, so it ended up resolving the urls and working. But still good to know for potential future purposes!
  8. Hey all! I'm running a script that downloads a file from a site. The client facing url looks something like this http://media.site.com/83jdks9dj?id=1 when I put that url into the web browser it gets resolved to a large url that actually then stream/downloads the media. I'm using wget to download then place the file into a directory on my site. But the issue is that wget needs the resolved url not the url that you see in the code. Is there any way in php to store the resolved url in a var? in theory something like this $src = 'http://media.site.com/83jdks9dj?id=1'; //unresolved url $srcResolved
  9. Spoke to soon. while (strtotime($date) <= strtotime($end_date)) {echo "$date\n";$date = date ("Y-m-d", strtotime("+1 day", strtotime($date)));}
  10. Hey all! I'm trying to loop a date count, how would I put this in a loop? $start = date('Y-m-d'); and $end = date('Y-m-d', strtotime('+30 days'));Then the output would be... 2011-12-10 2011-12-11 2011-12-12 and so forth all the way up to 30 days... I know how to count numbers up in loops, but when it comes to date's I'm getting very confused. Any references or examples would be much appreciated! Thanks!
  11. figured it out. thanks for the references. foreach ($arr as $value){echo $value['people'][0]['name']. "<br />";};
  12. Well let me show you my confusion. Let see I'm trying to echo 'name' from my json list above... The json_encode($json, true) outputs this snippet.. array(1) { [0]=> array(8) { ["people"]=> array(1) { [0]=> array(3) { ["name"]=> string(3) "bob" ["url"]=> string(19) "http://www.bob.com" ["id"]=> NULL } } There more at the end... But just by looking at array examples and the such my logic tells me to do this (assume this is $arr). echo $arr[0]['people'][0]['name'];
  13. Yeah my purposed I'm trying to get specific information, so I guess you would say I know the direct path.
  14. Thanks. I've read that page, json_decode puts it into an array. But there are no examples on that page showing you how to get data that is as nested as the feed I'm getting. I f anyone could point me to a site that has examples where the data is similar to mine that would be great! Or show me a snippet here!
  15. chasethemetal

    Json N00B

    Hey all! Thanks again for the help on my earlier problems, much appreciated!!! I've got a new question dealing with json, as I am just beginning to fiddle with it! How would I echo out specific parts of this code in php? See json below. Thanks!! [{"people":[{"name":"bob","url":"http:\/\/www.bob.com","id":null}], "url":"http:\/\/www.site.com","status":"available","id":"1111111","datetime":null, "place": {"city":"Brooklyn","name":"Gallery","latitude":"40.7186480","region":"NY","country":"United States","url":"http:\/\/www.place.com","id":"222222","longitude":"-73.9602690"}, "datetime":"2012-0
  16. Bang! Got yeah. Then I can call the specific set in jQuery like data.resultSet1. Digital hug.
  17. A solution was found in my php topic that is related to this. Thanks to everyone! var jsonData = null; var jsonDataResult = $.ajax({url: "process.php",dataType: "json",async: false,success: (function(data) { jsonData = data.resultSet1; })});
  18. This ties into a topic I started in the PHP forums here var jsonData = null; var jsonDataResult = $.ajax({url: "process.php",dataType: "json",async: false,success: (function(data) { jsonData = data; })}); The php file is outputing this [ ["Date","Count1","Count2"],["12/09/2011",11,17], ["12/08/2011",23,55] ] The above code works. And I get my graph, now the question is. With ONE process.php file. How can I have multiple arrays being outputted with different data. And then in the jQuery above call that specific array set? Again any pointer and tips would be appreciated!
  19. Thanks! I want to explore that method, however it didn't output the data right... This is what is needs to look like [ ["Date","Count1","Count2"],["12/09/2011",8,14], ["12/08/2011",23,55] ] And the output of thescientists method. The one strange thing that I noticed is it added \ slashes to the dates... and stripslashes() didn't seem to do anything. ["Date","Count1","Count",["12\/09\/2011",8,14],["12\/08\/2011",23,55] ] This topic is more or less solved, but I have one more question for anyone out there. How would I add a parent label to this set of data? basically this is one set of da
  20. Stop your typing figured it out! if ($stats2 != '') {$stats2.=', ';} $stats1 = '[["Date","Count1","Count2"],';$stats2 .= '["'.$date.'",'.$result->getCount1().','.$result->getCount2().']';$stats3 = ']'; I just needed the code to look like what that array looked like when outputted as json. and this little method worked!
  21. Hey all! I have a question in how one could dynamically build an array. This is what my static array looks like and my dynamic one needs to be formatted like. $data = Array ();$data [] = Array ("Date", "Count1", "Count2");$data [] = Array ("2008", 300, 400);$data [] = Array ("2009", 500, 700);$data [] = Array ("2010", 700, 300);$data [] = Array ("2011", 900, 100);$data [] = Array ("2012", 500, 400); Now I have an API giving me the information I need but it is not formatted at all like this. This is the source of information that needs to be formatted like above. foreach($g->getResu
  22. Thanks for the pointers. I've got my work cut out for me. After some reading I realize that the google charts api has special ways to call the graphs using ajax and the such. You can just do it that way and thats most likely why the charts won't render for me. I'll post any findings! thanks!
  23. Thanks. Well I do need to include the script, its pointing to the google charts API, not jQuery, and the charts API is written in javascript. This is exactly what I am attempting to load from process.php through the load() method onto index.php. echo "<script type='text/javascript' src='https://www.google.com/jsapi'></script> <script type='text/javascript'> google.load('visualization', '1', {packages:['corechart']}); google.setOnLoadCallback(drawChart); function drawChart() { var data = new google.visualization.DataTable(); data.addColumn('str
  24. I guess I should explain more of whats going on. And I apologize I'm not actually loading jQuery I am in fact loading javascript. Whats going on on in the process.php page is the Google Charts API, and I have php graphing information into the API. So the code looks more like this <div id="chart"></div><script that points to the api></script><script>graph script here</script> and when I load() this into index.php the only thing that comes through is the <div id="chart"></div> the scripts don't seem to execute, though using safaris inspect element
×
×
  • Create New...