Hi Guys,
Thanks, once again, for the helpful advice. Although admittedly a trifle late, I just wanted to say that this post can be officially closed as 'Solved'. Just for information for anyone with similar issues the problem, as suspected, was a single quote escaped with one backslash, where in actual fact three backslashes are required. This is due to the fact that the preceding backslash is removed by php but then passed on to the Javascript which also requires the quotes to be escaped. (Thats a non-techy explanation, by the way, I'm sure its much more complicated than that)