Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Mar 2007
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Retrieving Javascript

    I'm attempting to use AJAX to create a configurator for the product my company sells. In essence, I'm importing from a php file the controls that are necessary to configure out product based on the selections the user makes in previous controls.

    All of these choices involve javascript to control those controls and validate them. Is it possible to import Javascript as an attached sheet based on the AJAX?

    For example, we sell signs and if the user orders a certain type of enclosure there are all sorts of rules to follow. Could I swap (or add) the attached script file on the fly so the user wouldn't be forced to download all of the Javascript for all of the choices beforehand? Much of this js they wouldn't need based on their choices.

    Does this make sense?

  • #2
    Senior Coder
    Join Date
    Nov 2006
    Posts
    1,000
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yes it is possible (if I correctly understand your question). Here is the code I have in my library for it.

    Code:
    /* global eval code based on blog post on ajaxian written by Joseph Smarr */
    
    exfer.evalCodeToGlobal = function (sJSCode) {
      if (window.execScript) {
        window.execScript(sJSCode);
        return null;
      }
      var globalNamespace = this;
      return(globalNamespace.eval ? globalNamespace.eval(sJSCode) : eval(sJSCode));
    };
    david_kw


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •