Jump to content

Solarpitch

Members
  • Posts

    708
  • Joined

  • Last visited

About Solarpitch

  • Birthday 02/14/1985

Profile Information

  • Gender
    Male
  • Location
    Dublin, Ireland

Solarpitch's Achievements

Advanced Member

Advanced Member (4/5)

0

Reputation

  1. Guys, many thanks for your help! I totally understand now cheers!
  2. Yeah, while I can mange looking through arrays or objects... I'm confused as to how I can loop through what I just created.
  3. Apologies, arrays are not my strong point.. indenting it would be a task in itself. And I still havent a clue what the problem is. EDIT: I'm thinking I might need to go down the route of something like but not really sure. <?php foreach($get_questions as $key => $value){ ?> ..
  4. Hey Guys, I'm after creating an array of some description and cant seem to figure out how to get the data from it: The array looks like this... Array ( [1] => Array ( [0] => stdClass Object ( [id] => 1 [question] => Sprint Planning duration: between 2-4 hours [question_category] => 1 [created] => [category_name] => Sprint Planning [question_id] => 1 ) [1] => stdClass Object ( [id] => 1 [question] => Team used Roman Voting to agree what user stories will be part of the sprint [question_category] => 1 [created] => [category_name] => Sprint Planning [question_id] => 2 ) [2] => stdClass Object ( [id] => 1 [question] => Backlog is correctly prioritized [question_category] => 1 [created] => [category_name] => Sprint Planning [question_id] => 3 ) [3] => stdClass Object ( [id] => 1 [question] => Team discuss user story and acceptance criteria for each story and have clear understanding of what is expected [question_category] => 1 [created] => [category_name] => Sprint Planning [question_id] => 4 ) [4] => stdClass Object ( [id] => 1 [question] => Each user story in the sprint is Sprint Ready [question_category] => 1 [created] => [category_name] => Sprint Planning [question_id] => 5 ) [5] => stdClass Object ( [id] => 1 [question] => There are between 5-20 user stories in the sprint [question_category] => 1 [created] => [category_name] => Sprint Planning [question_id] => 6 ) ) [2] => Array ( ) [3] => Array ( ) ) I'm trying this but get the below error. $get_questions holds the above array. <?php foreach($get_questions as $question){ echo $question->category_name; ?> error: A PHP Error was encountered Severity: Notice Message: Trying to get property of non-object
  5. The white space was an issue. Works when I do: urlencode(trim($sourceId)) Sojust needed to trim that off.
  6. Hey Guys, I'm retrieving a name from a POST and using urlencode() but it seems to be giving an incorrect url. ... $sourceName = $_POST['val']; // echos here as " Conor Maynard " echo $url = "http://www.site.com/api/artist/details?aname=".urlencode($sourceName)."&id=mymHPtI3wp&format=xml"; The output is: http://www.site.com/api/artist/details?aname=%0A++++++Conor+Maynard%0A++++&id=mymHPtI3wp&format=xml If I just do $soureName = "Conor Maynard"; as hardcoded it works fine, but doesnt seem to like the value when assigned from the POST.
  7. No whitespace after PHP tag also tried: var res = $.trim(response); obj = JSON.parse(res); but still seem to get the same message,.
  8. Hey Guys, I'm sending a php array in JSON to a JS function like this: $arr= array( 'a' => "Gerard", 'b' => "Jonathan" ); echo json_encode($arr); I can see it's being sent like: {"a":"Gerard","b":"Jonathan"} However, when I try and retrieve it in the javascript function below I get an error: SyntaxError: JSON.parse: unexpected non-whitespace character after JSON data obj = JSON.parse(response); $.post('http://site.comi/ajaxApiCall', 'val=' + val, function (response) { obj = JSON.parse(response); alert(obj['a']); }); Still get the error even if I dont use JSON.parse. Just not sure where I'm going wrong.
  9. It actually works when I replace the return with echo.
  10. When I try do that: obj = JSON.parse(response); alert(obj.count); I just get this error. Dunno why :-\ SyntaxError: JSON.parse: unexpected end of data obj = JSON.parse(response);
  11. Hey Guys, Just trying to pass a php array to a Javascript function but I keep getting undefined. I'm sure my syntax is slightly incorrect. PHP ... $arr = array(); $arr[0] = $this->load->view('video',); $arr[1] = "A String"; return json_encode($arr); // this returns to the below Javascript $.POST responce. Javascript ... $.post('http://mysite.com//api/ajaxApiCall', 'val=' + val, function (response) { alert(response[0]); alert(response[1]); });
  12. Hi Guys, I have the following simple carousel code that slides a list of items left and right. Image below also shows you how it currently looks with the first active item to the left. Using the code below is there any way I can have the first active item in the center of the carousel. Ideally I want to be able for the carousel to be able to jump to a specific item also. if I have the following and I've been passed data-id of "104" lets say, I want this to be the center active item in the carousel when I populate it. <ul> <li data-id="100"></li> <li data-id="101"></li> <li data-id="102"></li> <li data-id="103"></li> <li data-id="104"></li> <li data-id="105"></li> </ul> var item_width = $('#navigation_ul li').outerWidth() + 10; if(where == 'left'){ var left_indent = parseInt($('#navigation_ul').css('left')) + item_width; }else{ var left_indent = parseInt($('#navigation_ul').css('left')) - item_width; } $('#navigation_ul:not(:animated)').animate({'left' : left_indent},100,function(){ if(where == 'left'){ $('#navigation_ul li:first').before($('#navigation_ul li:last')); }else{ $('#navigation_ul li:last').after($('#navigation_ul li:first')); } $('#navigation_ul').css({'left' : '-300px'}); });
  13. Hi Guys, I have a simple slider I've code with jQuery that moves through a list of <li> elements. I want the user to have a option to show smaller thumbs and in doing so the slider changes to 2 rows of <li>. I've attached an example of what I'm talking about. Not sure what the best way to approach this is, maybe more of a css question? When the user switches between the 2 views I want the next <li> in the large view, to be the element below in the small view. Any help would be great.
  14. figured it out.// $(".ppc_thumb[data-id=" + dataID + "]").addClass('ppc_thumb_playing');
  15. Ah right, It's sorta working now, the only thing is it applies the class to all of the ppc_result div's.. I just want to apply the class to that div with the specific data-id..
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.