处理 js / jquery / ajax - 无法加载草图

发布于 2024-12-16 00:09:21 字数 857 浏览 1 评论 0原文

我正在尝试使用以下代码:

$('#clicker').click(function(){
  var canvasRef = $('<canvas id="project_canvas"/>');
  var p = Processing.loadSketchFromSources(canvasRef, '/anything.pde');
  $('#loader').append(canvasRef);
});

使用 jquery / ajax 加载处理 js 草图,它正在做一些奇怪的事情 - 试图分解 /anything.pde 的所有字符并抛出此错误:

GET http://localhost:8888/a 404 (Not Found)
GET http://localhost:8888/n 404 (Not Found)
GET http://localhost:8888/n 404 (Not Found)
GET http://localhost:8888/y 404 (Not Found)
GET http://localhost:8888/t 404 (Not Found)
GET http://localhost:8888/h 404 (Not Found)
GET http://localhost:8888/i 404 (Not Found)
GET http://localhost:8888/g 404 (Not Found)
GET http://localhost:8888/p 404 (Not Found)
GET http://localhost:8888/d 404 (Not Found)
GET http://localhost:8888/e 404 (Not Found)

知道发生了什么吗?

I'm trying to use the following code:

$('#clicker').click(function(){
  var canvasRef = $('<canvas id="project_canvas"/>');
  var p = Processing.loadSketchFromSources(canvasRef, '/anything.pde');
  $('#loader').append(canvasRef);
});

To load a processing-js sketch using jquery / ajax and it's doing something weird - trying to break up all the characters of /anything.pde throwing this error:

GET http://localhost:8888/a 404 (Not Found)
GET http://localhost:8888/n 404 (Not Found)
GET http://localhost:8888/n 404 (Not Found)
GET http://localhost:8888/y 404 (Not Found)
GET http://localhost:8888/t 404 (Not Found)
GET http://localhost:8888/h 404 (Not Found)
GET http://localhost:8888/i 404 (Not Found)
GET http://localhost:8888/g 404 (Not Found)
GET http://localhost:8888/p 404 (Not Found)
GET http://localhost:8888/d 404 (Not Found)
GET http://localhost:8888/e 404 (Not Found)

Any idea what's going on?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

蓝咒 2024-12-23 00:09:21

应该作为数组传递:

var p = Processing.loadSketchFromSources(canvasRef, ['/anything.pde']);

顾名思义,loadSketchFromSources,Sources,您可以将多个源作为数组传递。

Should be passes as an array:

var p = Processing.loadSketchFromSources(canvasRef, ['/anything.pde']);

As the name says loadSketchFromSources, Sources, you can pass multiple source as an array.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文