I have a number of clickable objects on the screen that represent objects within a piece of software being interfaced through a COM component.
When I click on an object I send the name of the object, the session ID and the command I want to run.
The code for the particular command that I'm trying to implement is a C# based ASP.NET page:
case myClick:
dynamic simObj = S8COM.get_SimObject(Request[id]);
responseData = {name: + simObj.Name.ToString() + ,countInRoutes: + simObj.CountInRoutes.ToString() + ,countOutRoutes: + simObj.CountOutRoutes.ToString() + ,index: + simObj.Index.ToString() + ,capacity: + simObj.Capacity.ToString() + ,completed: + simObj.Completed.ToString() + ,routeOutMethod: + simObj.RouteOutMethod.ToString() + };
break;
This works fine for some objects, but not others, throwing an Uncaught SyntaxError: Unexpected number exception.
The JS I use to call this particular function is:
S8Web.Requestmanager.makeRequest({ data: { command: myClick, id: aItem.id }, async: true, callback: function(data){
alert(data.CountInRoutes); //Do a vardump of the response
}});
A couple of responses as well, the first one works fine, whereas the second throws the Unexpected Number exception:
jsonp1319203225074({name:Start,countInRoutes:0,countOutRoutes:1,index:5,capacity:0,completed:0,routeOutMethod:4});
jsonp1319203225066({name:Process 1,countInRoutes:1,countOutRoutes:1,index:1,capacity:1,completed:0,routeOutMethod:1});
The only thing I can see that could possibly affect the outcome is the whitespace between Process and 1. Is that what is throwing this error?