Hi, I think you're going to need a bit more command of JavaScript before you can take this on. Don't take that the wrong way, we're all new at things periodically -- if we're smart enough to try new things!
I'd suggest spending a bit of time with a decent JavaScript book like Flanagan's[1]. I don't think it'll take you long at all to get up-to- speed enough to do what you're looking to do, but you do seem to need a couple of fundamentals. [1] http://www.amazon.co.uk/dp/0596101996 / http://www.amazon.com/dp/0596101996 FWIW, -- T.J. Crowder tj / crowder software / com Independent Software Engineer, consulting services available On Mar 12, 2:38 pm, ArGoN <[email protected]> wrote: > I'm not so good at javasript but yet I started to work on a project > which have massive untidy pages. Extjs is being used in all pages. > almost %99 percent is the only Ext.Ajax.request() > I want to remove extjs from header and only include in thoose really > using it (not more than a few). (And slowly recode all pages in > prototype) > But the problem is there are too many simple Ext.Ajax.request() calls > in hundereds of pages. It's nearly impossible to go and change the > codes one-by-one. > Instead I want to write a function that takes the parameters and uses > prototype to do the job; and include in global header right after > prototype.js. > Another words there will be an Ext.Ajax.request() but it won't be Ext. > The idea is ok. But I coul'nt make it working. As I said I'm not good > at JS > All the request are as: > //-------------------------------------------------------- > function something(params){ > some_functions(); > //... > Ext.Ajax.request({ > url: '/something.php='+something, > success: function(result, request) { > loadingGif.className='hidden'; > somefunctions(params); > }, > failure: function(result, request) { > loadingGif.className='hidden'; > Ext.MessageBox.alert('Error',result.responseText); > return false; > }, > timeout: (30*1000) > }); > some_other_functions(); > //...} > > //---------------------------------------------------------- > And My idea is like > //----------------------------------------------------------- > function request(params){ > //get the parameters > //reset them for prototype > var url = //taken url parameter > var ajax = new Ajax.request() > //............... > //............... > //............... > //return failure as false else true;} > > var Ext; > Ext.Ajax=null; > Ext.Ajax.prototype.request=request; --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~----------~----~----~----~------~----~------~--~---
