Hi Eric, I have similar code except I have an alert() upon entry to the callback function. Whenever there are no entries my alert() never happens...
Paul ----- Original Message ---- From: Eric (Google) <[EMAIL PROTECTED]> To: Google Base Data API <[email protected]> Sent: Tuesday, September 16, 2008 2:07:49 PM Subject: [Google-Base-API] Re: How to get JSON callback with no results Hi Paul, If you have 0 entries (items), the json object passed to the your callback will have an undefined entry property: var myFunction= function(jsonObj) { var entries = jsonObj.feed.entry || []; if (entries) { alert(entries.length); } else { // no entries } }; p.s. There are a few samples here that use json-in-script: http://code.google.com/apis/base/samples/javascript/javascript-sample.html Eric On Sep 16, 5:40 am, paul <[EMAIL PROTECTED]> wrote: > Hi, > > I just started with google base and JSON, all is going well except > that my callback does not get called if there are no results. > > I am using "?alt=json-in-script&callback=myFunction" at the end of > the query. I would expect to get a callback with 0 json entries but I > get nothing. > Is there any way to get notified when the query is finished when there > are NO results? > > I could start a timer but I was hoping to avoid doing that. > > Thanks in advance... > > Paul --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Base Data API" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/Google-Base-data-API?hl=en -~----------~----~----~----~------~----~------~--~---
