Path: csiph.com!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Ben Bacarisse Newsgroups: comp.lang.javascript Subject: Re: How to pass a php variable to a javascript file (function)? Date: Fri, 02 Oct 2015 13:51:35 +0100 Organization: A noiseless patient Spider Lines: 41 Message-ID: <87fv1tsaaw.fsf@bsb.me.uk> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="017616aa25f81ec581c44d76d61ba2f3"; logging-data="27366"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Y2giuJDyULfFR2dZnze3fONdgfaJObOE=" Cancel-Lock: sha1:u4/PfV9iMqDjTUurJVxYpu5D7Is= sha1:uhwjRc4PkgDI5dlwUg6G53c82cU= X-BSB-Auth: 1.63a88fe532955dabf594.20151002135135BST.87fv1tsaaw.fsf@bsb.me.uk Xref: csiph.com comp.lang.javascript:28784 JiiPee writes: > ok, am currently testing this. But my code in php is not even able to > call javascript function (in an external file). What am i doing wrong: > > php file: > ------------ > > > ...// some button triggers callExternalJSFunction() > > > > > test.js file > ---------- > function sayGoodbye(){ > alert("Bye!"); > } > ------------------------ > > What is wrong here? why sayGoodbye is get called? how should i do > this? after that I guess it will be easy to send the data as well, but > I cannot even get the function call working now.. :) my brain does not > work :) You are not helping us to help you. Put an actual example online so we can go and find out what's wrong. If you can't do that, post the actual files that make up your test. If you do put up an example, it helps if you also make a text file for every PHP file. I.e. if your test page is called test.php, you also put an exact copy called test.php.txt on the server. If you don't do this we have no way of seeing the PHP code. -- Ben.