something i want to do in Web2py is to support web2py template codes inside JS files :) ! Coz my whole View logic now is javascript Thanks to qooxdoo!
But OP doesn't seem to have that problem. On Sat, Nov 10, 2012 at 2:03 AM, Derek <sp1d...@gmail.com> wrote: > No, he's trying to use a web2py function within the javascript, or have > web2py write javascript instead of html. I'm not sure it can do that. > > > On Friday, November 9, 2012 3:37:10 AM UTC-7, lyn2py wrote: >> >> Do you mean that you want the code to appear on the webpage? >> >> Save your code into a file in the static folder, and include in your >> views file using response.files: >> {{response.files.append(URL('**static','js_folder/your_file.**js'))}} >> >> >> On Wednesday, November 7, 2012 5:39:36 PM UTC+8, Ali Alroomi wrote: >>> >>> hello plz i need help i need t write web2py code into javascript ike >>> the following my code plz any help with the this: >>> >>> >>> $.fn.fancybox = function(options) { >>> $(this).data('fancybox', $.extend({}, options)); >>> >>> $(this).unbind('click.fb').**bind('click.fb', function(e) { >>> e.preventDefault(); >>> >>> if (busy) return; >>> >>> busy = true; >>> >>> $(this).blur(); >>> >>> selectedArray = []; >>> selectedIndex = 0; >>> {{for i in db().select(db.Project.ALL):}} >>> var rel = $(this).attr('rel') || ''; >>> var message = {{=i.CategoryID}}; >>> var url = "?pro=" + escape(message); >>> >>> if (!rel || rel == '' || rel === 'nofollow') { >>> selectedArray.push(this); >>> >>> } else { >>> selectedArray = $("a[rel=" + rel + "], area[rel=" + >>> rel + "]"); >>> selectedIndex = selectedArray.index( this ); >>> /*window.open(url, "_self");*/ >>> history.replaceState({}, "Title", url); >>> >>> >>> } >>> >>> >>> >>> >>> >>> >>> fancybox_start(); >>> >>> return false; >>> }); >>> >>> return this; >>> }; >>> >> -- > > > > --