sparklechic007 Posted August 31, 2010 Share Posted August 31, 2010 Hi, I'm wondering if anyone can tell me if there's a work around for calling js files in php. Basically, I have an autosuggest field which is calling from a database. However, when I try to use the js by using 'require_once' in php if I click on one of the entries on the autosuggest list it won't fill the textfield. If I include the .js file in <html> at the top of the page I get 'headers already sent (by my configuration file linking to the database).' I've also tried to include the <script> in the php instead using single quotes but this doesn't work. I can't change my configuration file as it's used by other pages, and I can't really put the form into a separate html file because it uses other code as well for when the actual submit button is sent (this is separate from the autosuggest). All I'm wondering is if there's another way to call the javascript in the PHP Quote Link to comment Share on other sites More sharing options...
RussellReal Posted August 31, 2010 Share Posted August 31, 2010 in MOST php applications (excluding COMET or PUSH implementations) after the php has finished being executed, php exits.. meaning you cannot continue to modify the output the user sees already.. php is for the most part server side, with another select few exceptions, but for most WEB APPLICATIONS it is 98% server side, with like I said before, COMET and PUSH applications.. JavaScript, however, is a CLIENT SIDE language with another few exceptions.. but for the most part this is the language you will want to utilize to manipulate information already sent to the client (the browser). Quote Link to comment Share on other sites More sharing options...
sparklechic007 Posted August 31, 2010 Author Share Posted August 31, 2010 Silly me, I left out the id of the textfield. Boy do I feel silly! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.