View Full Version : scripttag proxy not working!!

20 Nov 2011, 2:22 PM
I'm working on a google places api search for my app. I'm using a store with a scripttag proxy to get the results.
here's my controller for the search:

searchlocations: function(){

PlacesStore = new Ext.data.Store({
model: 'places',
proxy: {
type: 'scripttag',
url: https://maps.googleapis.com/maps/api/place/search/json?location=42.86508600000001,-71.4934&radius=5000&types=establishment%7Cstore%7Cfood%7Crestaurant%7Cgrocery_or_supermarket&name=romanos&sensor=true&key=AIzaSyBcl1TJuKA9qVJNBF1tf4TggBNndMgtLes&_dc=1321826318959&limit=25&callback=stcCallback1001',
reader: {
type: 'json'
// root: 'results'

scope: this,
callback: function(records, operation, success){
// console.log(records);
// console.log(operation);



It's getting a response back from google that is valid json, but the console logs this error every time

Uncaught SyntaxError: Unexpected token : json:2

any help would be awesome!!

21 Nov 2011, 9:42 AM
Most of the time this error happens is invalid response. Using ScriptTagProxy, the JSON should be wrapped in a call back function sent in the request... here is an example:

stcCallback01({"success" : true, "total" : 1000, "data" : [....]});

From what it sounds like is you are getting this and this is invalid for ScriptTagProxy:

{"success" : true, "total" : 1000, "data" : [....]}

21 Nov 2011, 9:52 AM
I'm just having trouble figuring out exactly how to wrap the response in a callback function

21 Nov 2011, 10:43 AM
It has to be done server side