Arc Forumnew | comments | leaders | submitlogin
1 point by revorad 5552 days ago | link | parent

Ok, now that I've gotten around to give this a serious try, I'm having trouble displaying anything. It seems arc has a problem using .js files because I tried doing something very basic with jquery and it didn't work. Even generating the following html as an arc op doesn't work, even though saving it as a plain html page works perfectly fine. Can anyone enlighten me please?

  <html>
  <head>
  <script type="text/JavaScript" src="jquery-1.3.2.min.js"></script>
  <script type="text/JavaScript">
  $(document).ready(function(){
   $("#generate").click(function(){
  alert('hello');
  });
  });
  </script>
  </head>
  <body>
  <div id="wrapper">
  <div id="quote">
  </p></div>
  <input type="submit" id="generate" value="Generate!">
  </div>
  </body>
  </html>


4 points by fallintothis 5552 days ago | link

srv.arc isn't configured to serve static Javascript. You'll need to patch it:

  $ diff -u old-srv.arc new-srv.arc                           
  --- old-srv.arc      2009-08-04 11:51:09.000000000 -0700
  +++ new-srv.arc     2009-10-10 16:11:21.000000000 -0700        
  @@ -152,10 +152,11 @@                                      
   Connection: close"))                                      
                                                             
   (map (fn ((k v)) (= (type-header* k) (gen-type-header v)))
  -     '((gif       "image/gif")                            
  -       (jpg       "image/jpeg")                           
  -       (png       "image/png")                            
  -       (text/html "text/html; charset=utf-8")))           
  +     '((gif             "image/gif")                      
  +       (jpg             "image/jpeg")                     
  +       (png             "image/png")                      
  +       (text/html       "text/html; charset=utf-8")       
  +       (text/javascript "text/javascript")))              

   (= rdheader* "HTTP/1.0 302 Moved")

  @@ -242,6 +243,7 @@
              "htm"  'text/html
              "html" 'text/html
              "arc"  'text/html
  +           "js"   'text/javascript
              ))))

   (def respond-err (str msg . args)
Then it should work.

-----

3 points by revorad 5552 days ago | link

Ah thanks! I did try the second change but missed the first one. Finally, I can use js properly with arc. Joy to the world.

-----