Note that there are some explanatory texts on larger screens.

plurals
  1. POAngularJS unexpected token in fromJson()
    primarykey
    data
    text
    <p>The following line of code:</p> <pre><code>var sid = $cookieStore.get('PHPSESSID'); </code></pre> <p>is throwing this error:</p> <pre><code>SyntaxError: Unexpected token m at Object.parse (native) at Object.fromJson (https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.js:779:14) at Object.angular.module.factory.factory.get (https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular-cookies.js:149:34) at Object.getAllImages (https://7-september.com/photoslide/js/services.js:29:36) at new Management (https://7-september.com/photoslide/js/controllers.js:54:18) at invoke (https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.js:2902:28) at Object.instantiate (https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.js:2914:23) at $get (https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.js:4805:24) at update (https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.js:14198:26) at Object.$get.Scope.$broadcast (https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.js:8307:28) </code></pre> <p>So, I put a breakpoint at angular.js at line 779. The code there is:</p> <pre><code>777 function fromJson(json) { 778 return isString(json) 779 ? JSON.parse(json) 780 : json; 781 } </code></pre> <p>The value of <code>json</code> as passed into <code>JSON.parse()</code> is "mnp801fap6kor50trgv4cgk7m2".</p> <p>I also noticed that other things getting passed into that method usually have two quotes around them, like ""userName"" for example.</p> <p>Please help. I'm banging my head against this for a couple hours.</p> <p>Or, if someone knows a better way to get the php session id out of the cookies using Angular, that would be great, too. (Yes, I could do it using jQuery or bare-metal JS, but I'd prefer to keep using Angular).</p> <p>Thanks in advance!!!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload