On Oct 17, 12:07 am, Mark Lacas <[EMAIL PROTECTED]> wrote:
> I have looked high and low and can only find references for dynmically
> loading javascript using ajax from a file.
>
> I have chunks of javascript that I want to keep in MySQL and load them
> on demand.
>
> They are simple chunks of text that end up in a variable.
>
> I need to inject the text from that variable into the dom and have it
> be functioning javascript.
>
> Thanks for any insights as to how to do this.
>
> I'm really stuck and have been for a few days on a deadline that is
> overdue.
>
> ml
You should tell your server you need a piece of javascript, but not
give any way for the javascript to access directly the database. Use
php or any scripting language you have on your server to do the job :
parse the request, connect to the db, retrieve the data needed,
generate the response. You can't do it all in javascript, which is
client side, and what you need is server-side processing.
To connect directly to the MySQL port on the server, you must set what
port you want to reach, and I hope for you the administrator has
closed this port to the remote sollicitations, because otherwise it's
just a gentle invitation for bad behavioured hackers to put a big mess.