page3.html is my scenario, it has a value that I want to pass to a
function located in thing.js.

Once I minify, my methods won't be called the same names (obviously),
so I was wondering how I can call that same function.

To clarify, let's say my external JS file has a name spaced method
like this:
JS.myNameSpace.doAjax(myParam);

JS.myNameSpace.doAjax is called from pageN.htm where it would pass
'myParam'.

Make sense?

Thanks!


On Mar 15, 12:53 pm, Peter Higgins <[email protected]> wrote:
> I think he wants the function to be aware of the page it was included
> from. Eg:
>
> page1.html
>      var infos = { url:"bar.php" }
> <script src=thing.js>
>
> page2.html
>      var infos = { url:"baz.php" }
> <script src=thing.js>
>
> thing.js
>      window.onload = function(){
>          ajaxftw({
>              // not really a "global config object".
>              url: infos.url
>          })
>      }
>
> It would probably make more sense to make thing.js just be a function,
> and call the function from the pageN.html
>
> page3.html
> <script src=thing.js>
> <script>window.onload = function(){ ajaxftw{ { url:"bar.php" } ) }</script>
>
> Or however. Or perhaps I missed the question too.
>
> ~phiggins
>
> On 3/15/11 12:44 PM, Michael Geary wrote:
>
> > Minifying a .js file shouldn't affect how you call functions in that
> > file. Simply call them as you normally would.
>
> > In your case, I think you'd want to embed a function call with the
> > required parameter in the generated source for each page.
>
> > Or did I miss something? If so, explain in more detail...
>
> > -Mike
>
> > On Tue, Mar 15, 2011 at 9:30 AM, Wilkins <[email protected]
> > <mailto:[email protected]>> wrote:
>
> >     I have an AJAX function located in an external JS file that needs to
> >     be called per page to load specific data. Each page has a value that
> >     needs to be passed into this function. When my files get minified, how
> >     can I call that same function on each page?
> >     Should I be taking a different approach to this?
>
> >     --
> >     To view archived discussions from the original JSMentors Mailman
> >     list: http://www.mail-archive.com/[email protected]/
>
> >     To search via a non-Google archive, visit here:
> >    http://www.mail-archive.com/[email protected]/
>
> >     To unsubscribe from this group, send email to
> >     [email protected]
> >     <mailto:jsmentors%[email protected]>
>
> > --
> > To view archived discussions from the original JSMentors Mailman list:
> > http://www.mail-archive.com/[email protected]/
>
> > To search via a non-Google archive, visit here:
> >http://www.mail-archive.com/[email protected]/
>
> > To unsubscribe from this group, send email to
> > [email protected]
>
>

-- 
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/[email protected]/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/[email protected]/

To unsubscribe from this group, send email to
[email protected]

Reply via email to