Path: csiph.com!weretis.net!feeder4.news.weretis.net!feeder5.news.weretis.net!news.solani.org!.POSTED!not-for-mail From: Thomas 'PointedEars' Lahn Newsgroups: comp.lang.php Subject: Re: Problem between PHP and JavaScript with json Date: Fri, 05 May 2017 10:24:16 +0200 Organization: PointedEars Software (PES) Lines: 39 Message-ID: <747003717.0ifERbkFSE@PointedEars.de> References: Reply-To: Thomas 'PointedEars' Lahn Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8Bit X-Trace: solani.org 1493972655 5240 eJwFwQcBwEAIBDBLZVM5rPMv4RMTJ59QN1eD4aaw59nCydQJOhX6hT+k8nZeRI3GAjsV9AAs6RHH (5 May 2017 08:24:15 GMT) X-Complaints-To: abuse@news.solani.org NNTP-Posting-Date: Fri, 5 May 2017 08:24:15 +0000 (UTC) User-Agent: KNode/4.14.2 X-NNTP-Posting-Host: eJwNyskBwDAIA7CVymGg45Bg9h+h1VuwkLjpgXAsttFbo1Qkmcqn/T1ijbOQdv+DMcjbNV46HzAUEew= X-User-ID: eJwNx8EBwCAIA8CVhASI4wit+4/Q3u8CaTnFjGTcuG+94gZmrSHlhlQ8HJ9Dss+EmTJ8wbru325tyDnogvgBLxoUaQ== Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEXTxa4RFk5dUWANED8PFEfy7+MGBiW+n3ZNF/QuAAACaElEQVQ4jVXUwVOcMBQG8Dc7Rc4PUntdWV2uxjDpGaGeozOp1woar4jd5t/v9wLstMwsA/ntlxdCAgUc1hjTc9/JCZfGoo3wG3HdmdAWrIJRHe7GM/TmpY5VFefuVcAkkPbLIaN8rmPmjloyZxgyR3GuJ4K0AGtJ2htz8o7yqikm759fldQXaMpbDzjKAG+8v+AugVTOPO5DOjLvGtUYQwh0CPjnVMyGd+8/GfUB5nLKJDD2aLDh5HYyMDJGDwQIo2ZmZcKbowNmAdB/AzyFhrmF2MHRb0QJJfaAnwGB6orZhoykLzJtGwF/xpYxI1dswomiUj3gTuAIqCn/4C7cULwGNBtwMTk3Y4LfKB5YUaOKBKYtpplm7u0vip8tU1NWWyI/7XdcSuIDoMt6rVHMWT0DbjHPGqDqZVSa6zleLcUTcIKLoMv3ueJluALtAo9B302zPPlrtiVScRdCjXvVh3e3JpYa/jjkuC9N+LrBMlz/eAN4eQijX2EdLo6c5tGGHwLyHFtXk89dDGHwCVhG9T0S/j55AhRZgkMCmUQXJ49TnS1wnQDvw0eAh9ICeMmEFbCnPMFzjAvsWoEWEFdYEx+S0MoUZ1gT1wId8+AF3Bl2OoEu906AUHx5VLw/gXYg/x84loOah/2UYNrgiwSwGO7RfUzVBbx/kgpckumGOi6QirtD6gkLTitbnxNol47S2jVc2vsN5kPqaAHT8uUdAJM4v/DanjYOwmUjWznGfwB7sGtAtor5BgofDuzaRj4kSQAqDakTsKORa3Q3xKi3gE1fhl71KRMqrdZ2AWNNg/YOhQyrVBnb+i+nEg4bsDA+egAAAABJRU5ErkJggg== Cancel-Lock: sha1:7hp7Q/6Tqh9+wxmKaeKCiGLtlTI= X-Face: %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&. On 03.05.2017 at 07:11, Une Bévue wrote: >> Le 02/05/2017 à 19:35, Christoph M. Becker a écrit : >>> for instance. Does the JSON >>> response specify an appropriate Content-Type header including the >>> correct charset? >> >> yes : >> >> header('Content-Type: application/json; charset=utf-8'); > > That appears to be correct. > > Don't know for what else to look. Maybe you should consider asking in > JavaScript/ECMAScript related newsgroup. ^^^^^^^^^^^^^^^^^^^^^ Among other things it looks like the old “method referenced as function” blunder: | getBackground () { | JSON.fetch("http://mbp.local/php/background-json.php", | this.setBackground); ^^^^^^^^^^^^^^^^^^ | }; Of course, the first thing to look for when one sees JSON.parse() issuing an error message is *the offending JSON.parse() call*. One does not go to the dentist if one’s foot hurts. If the OP would *finally* post with RFC-5536- *and* Netiquette-compliant headers, one might even read their postings directly, and advise them, *even if they were off topic*. But no name, no address – *no cookies*. -- PointedEars Zend Certified PHP Engineer | Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per E-Mail.