简体   繁体   中英

JQuery Mobile get JSON from url

UPDATED

I'm trying to incorporate some JSON data into a JQuery Mobile page. Using the following example code, I can get this to work, however when I use my own url the code fails to produce any content on screen.

Here is the starter -working- code:

    var li = "";
$.getJSON("http://api.flickr.com/services/feeds/photos_public.gne?tags=cat&tagmode=any&format=json&jsoncallback=?",
    function(data){
      $.each(data.items, function(i,item){
        li += '<li><a href="#" id="' + i + '" class="info-go">' + item.author + '</a></li>';
          $("#prof-list").append(li);
      });
    });

However, when I adapt the code to incorporate my own url JSON feed no content is produced.

    //set up string for adding <li/>
var li = "";
$.getJSON("http://aviationapp.codeclinic.de/showAvBuyerResults.aspx?source=avbuyer&resultSet=resultsbymodel&manufacturer=piper&model=arrow&callback=cheese",
    function(data){
      $.each(data, function(i,item){
        li += '<li><a href="#" id="' + i + '" class="info-go">' + manufacturer + '</a></li>';
          $("#prof-list").append(li);
      });
    });

Ive even gone so far as to format the JSON from my url to be similar to that of the Flickr url/JSON used in the example, but i still get no visible results.

Any ideas what I'm doing wrong / why its not working?

Your ASP.NET code isn't using the jsoncallback query string parameter to determine the function name for the JSON-P response.

It is also claiming that the response is text/html instead of application/javascript

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM