Hi, last couple of days i had been search all over the Internet an trying to find the solution. But no useso i really need your help here.
I have basic knowledge with ajax and jquery. I am working with api which returns the info back to the browser as a json format. I wrote the code which connects to the api server and get the josn data successfully. But main problem is with the representation of the json data.
I have setup the local environment for the work but as you know firefox doesn't show the info for some security reason. So i use ie8 for testing. In local environment the data represent ok. But when i upload the script into server ie have an error which says access denied? And also firefox have the json object null!
The platform i am using this is wordpress. Hopefully it not causing any problem.
here is the page i used the code: http://citystir.com/shopping/
Here is the code:
in the header:
In external js file.Code:// jquery code $(document).ready(function(){ var ywsid = "nP7LU8_uZABdb7A8U_dukQ"; var url ="http://api.yelp.com/business_review_search?location=chicago&cc=US&limit=4&category=shopping&ywsid="+ywsid; var dom = "#shopping_reviews"; callYelp(url, dom); });
Code:function callYelp(url, domnode){ jQuery.getJSON(url, function(data){ jQuery(domnode).empty(); jQuery.each(data.businesses, function(i, data){ printHtml(data, i, domnode); }); return false; }); } function printHtml(data, i, dom){ var review_no = 0; var html = " "; html += "<a href="+data.url+" title="+data.name+"alt="+data.name+"><img src="+data.photo_url+" alt="+data.name+"></a>"; html += "<p>Total reviews: "+data.review_count+"<p>"; html += "<img src="+data.rating_img_url+" alt="+data.avg_rating+"/>"; html += "<p>"+data.address1+"</p>"; html += "<p>"+data.address2+"</p>"; html += "<p>"+data.address3+"</p>"; html += "<p>Latest Review: "+data.reviews[review_no].text_excerpt+"</p>"; html += "<p>By <a href="+data.reviews[i].user_url+" title="+data.reviews[review_no].user_name+">"+data.reviews[review_no].user_name+">></a></p>"; html += "<p>Categories:"+get_items(data.categories);+"</p>"; jQuery(html).appendTo(dom); } function get_items(items){ var cat = " "; for (i=0; i <items.length; i++){ cat += "<a href="+items[i].search_url+" title="+items[i].name+">"+items[i].name+"</a> "; } return cat; }


so i really need your help here.
Reply With Quote

Bookmarks