I am creating a website which is going to require up-to-date iPhone App prices, such as on appshopper, and thanks to gbc here on stackoverflow I was directed towards using the iTunes Search API. I am somewhat familiar with PHP though I don't practice it that often and am not familiar with the use of JSON or how to extract values from it. I tried to use the tutorial here: http://webhole.net/2009/11/28/how-to-read-json-with-javascript/ to get it to work, though I had no luck, no data was pulled and I am not skilled enough to figure it out. I have also attempted numerous other tutorials, though the one above seemed to fit the closest to what I needed. This is going to be a necessary portion of the site, though it is not the key component of the site, so it doesn't need to be very robust, it just needs to work. I would appreciate any help, suggestions, or links.
Here is the code that I tried to use, I'm not sure if this is incapable of doing what I want it to or if I made some small error that I'm not sure of because I just followed a tutorial and don't know what I am doing.
<input type="text" id="query" /><button>search</button><br />
<div id="results">
</div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
var url='http://ax.itunes.apple.com/WebObjects/MZStoreServices.woa/wa/wsLookup?id=';
var query;
$('button').click(function(){
query=$("#query").val();
$.getJSON(url+query,function(json){
$.each(json.results,function(i,app){
$("#results").append('<p>'+app.trackName+'</p>');
});
});
});
});
</script>
Thank you, I really appreciate any help that anyone can provide.