Generic Service Unexpected Token
For some reason my generic service is returning a unexpected token error.
The generic service is set up to receive parsed data from a REST service and then edit it for mapping. It works for all of the other times I use it.
So, the data I am receiving is (after parsed)...
code
{"Data":[{"THREADTITLE" : "Cool Test","CREATEDDATE" : "May, 20 2013 00:00:00","DESCRIPTION" : "<p>
This is a test forum post.</p>","POSTDATE" : "May, 20 2013 17:18:19","LASTMODIFIED" : "May, 20 2013 00:00:00","POSTID" : "######","THREADID" : "######","FAMILY" : "Name","FIRSTNAME" : "Name","SPOUSEFIRST" : "Someone","EMAIL" : something@something.com"},{"THREADTITLE" : "Cool Test","CREATEDDATE" : "May, 20 2013 00:00:00","DESCRIPTION" : "<p>
Ooo that's cool</p>","POSTDATE" : "June, 11 2013 10:16:17","LASTMODIFIED" : "June, 11 2013 00:00:00","POSTID" : "######","THREADID" : "######","FAMILY" : "Name","FIRSTNAME" : "Name","SPOUSEFIRST" : "Someone","EMAIL" : "Email"}]}
/code
also, here is the generic service implementation...
code
$t.customImp = $t.createClass(null, {
init: function(requestOptions) {
this.__requestOptions = $.extend({}, requestOptions);
},
Code: Select all
process: function(settings) {
if (this.__requestOptions.echo) {
settings.success(this.__requestOptions.echo);
} else {
var cdata = getData();// load JSON data from javascript
settings.success(cdata);//send it to mapping
console.log("done");
}
settings.complete('success');
} });
/code
the getData() function returns the above JSON string.
I would normally be looking for a mistake for a lot longer than I did, but when I copy and past the response into the automatically create response feature in the generic service, it works smashingly.