Hello.
I'm working with lungojs, it's a mobile app framework.
I'm trying to make a call to a local drupalium distribution. but I get the error, I found this information

"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.

This is the code I get:

{
	"vid":"1",
	"uid":"0",
	"title":"Welcome",
	"log":"",
	"status":"1",
	"comment":"2",
	"promote":"1",
	"sticky":"0",
	"nid":"1",
	"type":"article",
	"language":"und",
	"created":"1333731742",
	"changed":"1333731742",
	"tnid":"0",
	"translate":"0",
	"revision_timestamp":"1333731742",
	"revision_uid":"0",
	"body":{
		"und":
			[{"
				value":"Welcome. You should generate some content using Devel Generate first and then visit Drupanium Debug, after that you should download the Drupanium App Source Code and start playing with it, enjoy.","summary":null,"format":"plain_text","safe_value":"<p>Welcome. You should generate some content using Devel Generate first and then visit Drupanium Debug, after that you should download the Drupanium App Source Code and start playing with it, enjoy.</p>\n",
				"safe_summary":""}
			]},
	"field_tags":[],
	"field_image":[],
	"rdf_mapping":{
		"field_image":{
			"predicates":["og:image","rdfs:seeAlso"],
			"type":"rel"}
		,"field_tags":{
			"predicates":["dc:subject"],
			"type":"rel"},
		"rdftype":[
			"sioc:Item",
			"foaf:Document"],
		"title":{
			"predicates":[
				"dc:title"]},
		"created":{
			"predicates":[
				"dc:date",
				"dc:created"],
			"datatype":"xsd:dateTime",
			"callback":"date_iso8601"},
		"changed":{
			"predicates":[
				"dc:modified"],
			"datatype":"xsd:dateTime",
			"callback":"date_iso8601"},
		"body":{
			"predicates":["content:encoded"]},
		"uid":{
			"predicates":["sioc:has_creator"],
			"type":"rel"},
		"name":{
			"predicates":["foaf:name"]},
		"comment_count":{
			"predicates":["sioc:num_replies"],
			"datatype":"xsd:integer"},
		"last_activity":{
			"predicates":["sioc:last_activity_date"],
			"datatype":"xsd:dateTime",
			"callback":"date_iso8601"}
	},
	"cid":"0",
	"last_comment_timestamp":"1333731742",
	"last_comment_name":null,
	"last_comment_uid":"0",
	"comment_count":"0",
	"name":"",
	"picture":"0",
	"data":null,
	"path":"http://localhost/drupanium/node/1"
}

This is my call with lungojs (lungojs api: http://www.lungojs.com/api/#doc-service-get ):

var url = 'http://localhost/drupanium/api/rest/node/1.json';
    	var data = {			
		datatype: 'json',
		contentType: 'application/json;charset=utf-8',
    		format:'jsonp',
    		callback: '?'
    	};

		lng.Service.get(url,data, function(response) {    	
	   		console.error(response)
		});

Thanks.

Oskar

pd: I have try lungojs with another services (panoramio) and it works great.

pd: I also finde this: http://developer.appcelerator.com/question/117562/trouble-parsing-json-f...

Comments

oskar_calvo’s picture

I have test the json code with: http://json-p.org/validator.html, and seems to be wrong.

Oskar

kylebrowning’s picture

Category: bug » support

For now this is a support request as there is no real evidence there is an issue with Services.

kylebrowning’s picture

Status: Active » Closed (cannot reproduce)