Adding custom Javascript or jQuery to your page in Rockets


Post #: 83
Post type: Blog post
Date: 2013-02-06 17:53:38.000
Author: Rocket Man

newLISP on Rockets comes with and works with jQuery, which lets you do all sorts of wild and wonderful things on your page. But where should you put your Javascript code?

It doesn't really matter where it goes as long as there are <script> tags around it, but sometimes you want to defer execution to the end of the page. This leads to the best performance, because the user isn't waiting for the Javascript to load before seeing the page elements.

I've modified (display-footer) to let you add a string of Javascript or jQuery code to your page and insert it right at the end. You assign the code to a string variable and then just call (display-footer "Your name" name-of-string-variable) and it will execute the Javascript or jQuery code at the end of the page.


ddenniss on 2013-06-21 22:29:09.000

Also it would be nice to be able to work with ajax, For example if to use ExtJS, then from the server side it will be required to work just with data, nomvc or any gui logic. The gui logic and navigation in that case move to the browser side..

Rocket Man on 2013-06-27 21:59:05.000

I've used AJAX calls through jQuery in some of my Rockets projects before, but I'm definitely planning on making some standard Rockets functions to make it easier to do and with less code.

I've played with ExtJS a bit, but I'm not completely sold on it yet. It's pretty bulky and I'm not sure how well it works on mobile (that may have changed, though). Still, it has some nice features. But if I was to use it, I would also want to write Rockets functions to make the syntax easier and cleaner. Still, there's nothing stopping you from using ExtJS in Rockets today if you want!

View this post in the forums

Views: 6043