I am creating a website that will require modern prices on the iPhone, for example, on appshopper, and thanks to gbc here in stackoverflow, I was aimed at using the iTunes search API, I am a little familiar with PHP, although I often do not do it, and I not familiar with using JSON or how to extract values ββfrom it. I tried using the tutorial here: http://webhole.net/2009/11/28/how-to-read-json-with-javascript/to make it work, although I was not lucky, there was no data, and I am not experienced enough to understand this. I also tried to complete many other lessons, although one of them seemed to be the closest to what I needed. This will be a necessary part of the site, although this is not a key component of the site, so it does not have to be very reliable, it just has to work. I would appreciate any help, suggestions or links.
Here is the code that I tried to use, I'm not sure if it is unable to do what I want, or if I made a small mistake that I'm not sure about, because I just followed the 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.
source
share