You do not have the wrong path added, not:
$(content).appendTo("#recipes");
Must not be:
$('#recipes').append(content);
In your for loop:
$.each(data.recipes, function(i,post){ content = '<p>' + post.i_name + '</p>'; content += '<p>' + post.i_recipe + '</p>'; content += '<img src="http://localhost/xdk/'+post.image_thumb+'"/>'; content += '<br/>'; }); $(content).appendTo("#recipes");
You reinitialize the content at each iteration, should you then move the append statement as the last line inside the loop?
$.each(data.recipes, function(i,post){ content = '<p>' + post.i_name + '</p>'; content += '<p>' + post.i_recipe + '</p>'; content += '<img src="http://localhost/xdk/'+post.image_thumb+'"/>'; content += '<br/>'; $(content).appendTo("#recipes"); });
I think that you get an error in the loop itself, you pass "i" as the first parameter, but you only refer to me as the name of the parameter. This will not work, as you think, I will be perceived as part of the variable name, not replaced by the value of "i", this is not a macro. If this is your intention, use:
post[i].i_name
I would also suggest using an alternative name other than post, something like aryRecipes, where the ary prefix tells everyone that the variable is an array. Try using some console.dir () statements in a loop to check the values.
eg:
$.each(data.recipes, function(i,post){ console.log("i :" + i + ", post:"); console.dir(post); content = '<p>' + post.i_name + '</p>'; content += '<p>' + post.i_recipe + '</p>'; content += '<img src="http://localhost/xdk/'+post.image_thumb+'"/>'; content += '<br/>'; $(content).appendTo("#recipes"); });