Dear jmol user list,
I have a problem.
In my project, i retrieve molecule in sdf from my database via ajax
calls + php. The molecule data is returned as json.
I am doing this because i want to load the molecules only if they are in
the browser view, like lazy loading. Ajax calls are made, no problem
here and the visibility question is already solved.
So i have the possible case to have multiple applets loaded without
content and then when they are displayed to the user, the molecule(s)
has to be loaded.
Here is the code :
$.ajax({
"dataType": 'json',
"type": "GET",
"url":
Routing.generate(myBundle_molstructure_ajax', {
"Id": id
}),
"success": function (dataStr) {
// get sdf and prepare
sdf="|"+String(dataStr['sdf']).replace(/\|/g,"");
sdf=sdf.replace(/\r\n/g,"|");
sdf=sdf.replace(/\n/g,"|");
sdf=sdf.replace(/\r/g,"|");
sdf=sdf.replace(/\|/g,"\n|");
eval("document." + applet_name +
'.LoadInline(\"' + sdf + '\");');
}
});
The error i got is :
SyntaxError: unterminated string literal at
document.jmol2.LoadInline("
Is there something i can do ?
I don't think my inline file preparation is wrong but who knows...
Thanks
------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users