Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/three.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails YUI3上传器+;轨道rjs_Ruby On Rails_Yui_Rjs_Uploading - Fatal编程技术网

Ruby on rails YUI3上传器+;轨道rjs

Ruby on rails YUI3上传器+;轨道rjs,ruby-on-rails,yui,rjs,uploading,Ruby On Rails,Yui,Rjs,Uploading,我正在尝试将YUI3上传程序用于Rails 2.3.12项目。我已经让它在上传后解析响应。响应是一个RJS文件,呈现一个部分,以更新页面上的元素 当通过正常的非闪存上传运行时,这个RJS可以像预期的那样工作,并且它可以像预期的那样与SWFUpload插件一起工作 在Firefox中,我得到一个错误: Error: missing } after property list Source File: http://secure.symt.localhost:3000/training_videos

我正在尝试将YUI3上传程序用于Rails 2.3.12项目。我已经让它在上传后解析响应。响应是一个RJS文件,呈现一个部分,以更新页面上的元素

当通过正常的非闪存上传运行时,这个RJS可以像预期的那样工作,并且它可以像预期的那样与SWFUpload插件一起工作

在Firefox中,我得到一个错误:

Error: missing } after property list
Source File: http://secure.symt.localhost:3000/training_videos/4/edit
Line: 0, Column: 204
Source Code:

try { __flash__toXML(YUI.applyTo("yui_3_4_0_2_1314649381592_1","SWF.eventHandler",["yuiswfyui_3_4_0_2_1314649381592_14",({data:"try {\nElement.replace(\"training_video_4_poster_current\", \"<div class=\\"current_file_name\\" id=\\"training_video_4_poster_current\\">Current poster: <a href=\\"https://symtools_development.s3.amazonaws.com/system/symt_development/training_videos/posters/4/original/logo with spaces.JPG?1314649390\\" target=\\"new\\">logo with spaces.JPG</a> &mdash; <a href=\\"#\\" onclick=\\"if (confirm('Are you sure?')) { new Ajax.Request('/attachments/delete/training_video/4/poster', {asynchronous:true, evalScripts:true, method:'delete', parameters:'authenticity_token=' + encodeURIComponent('zzoL7fhstIy16isJGUdNQJ7ab4TNN+lMlOfJcBVabfo=')}); }; return false;\\">[delete this file]</a></div>\");\nElement.replace(\"ajax-flash-container\", \"\n<div id='ajax-flash-container' style='display:none'>\n\n\t\n\t\t<div id='info-message-container'>\n\t\t<div class=\\"flash info\\">\n\t\t\t<div class=\\"info-icon\\">i</div>\n\t\t\t<div class=\\"message-contents\\">\n\t\t\t\t<ul>\n\t\t\t\t\t<li>File uploaded.</li>\n\t\t\t\t</ul>\n\t\t\t</div>\n\t\t\t<div class=\\"clear\\">&nbsp;</div>\n\t\t</div>\n\t</div>\n\t\n</div>\n<script type='text/javascript'>\n  setDoMessages();\n</script>\n\n\");\n} catch (e) { alert('RJS error:\n\n' + e.toString()); alert('Element.replace(\\"training_video_4_poster_current\\", \\"<div class=\\\\"current_file_name\\\\" id=\\\\"training_video_4_poster_current\\\\">Current poster: <a href=\\\\"https://symtools_development.s3.amazonaws.com/system/symt_development/training_videos/posters/4/original/logo with spaces.JPG?1314649390\\\\" target=\\\\"new\\\\">logo with spaces.JPG</a> &mdash; <a href=\\\\"#\\\\" onclick=\\\\"if (confirm(\'Are you sure?\')) { new Ajax.Request(\'/attachments/delete/training_video/4/poster\', {asynchronous:true, evalScripts:true, method:\'delete\', parameters:\'authenticity_token=\' + encodeURIComponent(\'zzoL7fhstIy16isJGUdNQJ7ab4TNN+lMlOfJcBVabfo=\')}); }; return false;\\\\">[delete this file]</a></div>\\");\nElement.replace(\\"ajax-flash-container\\", \\"\\n<div id=\'ajax-flash-container\' style=\'display:none\'>\\n\\n\\t\\n\\t\\t<div id=\'info-message-container\'>\\n\\t\\t<div class=\\\\"flash info\\\\">\\n\\t\\t\\t<div class=\\\\"info-icon\\\\">i</div>\\n\\t\\t\\t<div class=\\\\"message-contents\\\\">\\n\\t\\t\\t\\t<ul>\\n\\t\\t\\t\\t\\t<li>File uploaded.</li>\\n\\t\\t\\t\\t</ul>\\n\\t\\t\\t</div>\\n\\t\\t\\t<div class=\\\\"clear\\\\">&nbsp;</div>\\n\\t\\t</div>\\n\\t</div>\\n\\t\\n</div>\\n<script type=\'text/javascript\'>\\n  setDoMessages();\\n</script>\\n\\n\\");'); throw e }",type:"uploadcompletedata",id:"file0"})])) ; } catch (e) { "<undefined/>"; }

有什么想法吗?

算是解决了。为了这些操作,我放弃了RJ,而是编写了一个ERB模板来输出所需的javascript


RJS助手加上YUI上传器的JS包装和转义都是乱七八糟的——现在我只是在渲染我所需要的东西。

看来,转义特殊角色的几层在几层执行中被绊倒了。冒着陈述显而易见的风险,我会尝试将RJ简化到最低限度,并从那里开始工作。
Uncaught SyntaxError: Unexpected token ILLEGAL