Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3424620
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T06:29:46+00:00 2026-05-18T06:29:46+00:00

I started playing a bit with Sencha Touch. So I’ve built a really simple

  • 0

I started playing a bit with Sencha Touch.

So I’ve built a really simple application based on one of the examples just to see how it goes.

Basically it creates a JSON Request which executes a Last.FM web service to get music events near the user’s location.

Here’s the JSON code:

var makeJSONPRequest = function() {
        Ext.util.JSONP.request({
        url: 'http://ws.audioscrobbler.com/2.0/',
            params: {
                method: 'geo.getEvents',
                location: 'São+Paulo+-+SP',
                format: 'json',
                callback: 'callback',
                api_key: 'b25b959554ed76058ac220b7b2e0a026'
            },
            callback: function(result) {
                var events = result.data.events;
                if (events) {
                    var html = tpl.applyTemplate(events);
                    Ext.getCmp('content').update(html);                        
                }
                else {
                    alert('There was an error retrieving the events.');
                }
                Ext.getCmp('status').setTitle('Events in Sao Paulo, SP');
            }
        })
    };

But every time I try to run it, I get the following exception:

Uncaught SyntaxError: Unexpected token :

Anyone has a clue?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T06:29:46+00:00Added an answer on May 18, 2026 at 6:29 am

    A couple of things. First of all the "Uncaught SyntaxError: Unexpected token :" means the browser javascript engine is complaining about a colon ":" that has been put in the wrong place.

    The problem will most likely be in the returned JSON. Since whatever the server returns will be run though the eval("{JSON HTTP RESULT}") function in javascript, the most likely thing is that your problem is in there somewhere.

    I’ve put your code on a little sencha test harness and found a couple of problems with it.

    First: My browser was not too happy with the “squiggly ã” in location: 'São+Paulo+-+SP', so I had to change this to location: 'Sao+Paulo,+Brazil', which worked and returned the correct results from the audioscribbler API.

    Second: I notice you added a callback: 'callback', line to your request parameters, which changes the nature of the HTTP result and returns the JSON as follows:

    callback({ // a function call "callback(" gets added here
       "events":{
          "event":[
             {
                "id":"1713341",
                "title":"Skank",
                "artists":{
                   "artist":"Skank",
                   "headliner":"Skank"
                },
             // blah blah more stuff
          "@attr":{
             "location":"Sao Paulo, Brazil",
             "page":"1",
             "totalpages":"1",
             "total":"2"
          }
       }
    }) // the object gets wrapped with extra parenthesis here
    

    Instead of doing that I think you should be using the callbackKey: 'callback' that comes with the example in http://dev.sencha.com/deploy/touch/examples/ajax/index.js.

    Something like this for example:

       Ext.util.JSONP.request({
            url: 'http://ws.audioscrobbler.com/2.0/',
                params: {
                    method: 'geo.getEvents',
                    location: 'Sao+Paulo,+Brazil',
                    format: 'json',
                    api_key: 'b25b959554ed76058ac220b7b2e0a026'
                },
                callbackKey: 'callback',
                callback: function(result) {
                     // Output result to console (Firebug/Chrome/Safari)
                     console.log(result);
                     // Handle error logic
                     if (result.error) {
                        alert(result.error)
                        return;
                     }
                     // Continue your code
                    var events = result.data.events;
                    // ...
                }
            });
    

    That worked for me so hopefully it’ll work for you too. Cherio.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've just started playing with Django and am loosely following the tutorial with my
I have just started playing with the ASP.Net MVC framework, and today I created
Have just started playing with ASP.NET MVC and have stumbled over the following situation.
I just started playing with Django today and so far am finding it rather
I've just started playing with Google App Engine using php via Quercus. I'm not
I have started playing with Maven2 and I'm attempting to port one of my
Just for kicks I'm playing around a bit with C# and WPF. I'm going
I've started playing with Dojo a bit and I'm curious about variable scope issue
I've started playing with Lucene.NET today and I wrote a simple test method to
I just started playing with Berkeley DB a few days ago so I'm trying

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.