Hi i am not a php developer, ive never touched it before. but i have been asked to add a google shopping cart tracking code to a website. when someone completes an order then get sent to finishorder.php. when i go the finishorder.php file it looks like this: Show
which just looks like server script to me (coming from a .net background), so i presume i cannot add the javascript here, how does php decide get the layout for this page? how can i add the javascript code to this page. asked May 4, 2011 at 10:59
1 You can do this:
OR
Hmm? But I think that HandlePage() method will do something with our page so I'd look inside this method Class ISC_ORDER->handlePage() what it does... You can then echo Your within this method on appropriate place... EDIT:
Antony 14.8k10 gold badges44 silver badges73 bronze badges answered May 4, 2011 at 11:03
shadyyxshadyyx 15.6k6 gold badges54 silver badges94 bronze badges 2 You can add javascript inside a php code as
answered May 4, 2011 at 11:02
VaradaVarada 15.1k13 gold badges47 silver badges67 bronze badges You can add script in PHP page by 2 ways The first way is to add it in PHP tags
The second way is to add it after PHP code
answered May 31, 2017 at 19:07
Hetal1311Hetal1311 3643 silver badges13 bronze badges View Discussion Improve Article Save Article View Discussion Improve Article Save Article JavaScript is the client side scripting language and PHP is the server side scripting language. JavaScript is used as client side to check and verify client details and PHP is server side used to interact with database. In PHP, HTML is used as a string in the code. In order to render it to the browser, we produce JavaScript code as a string in the PHP code. Example 1: Write JavaScript code within PHP code
Output: Example 2: Write JavaScript code outside of PHP code (in same PHP file)
Output: Example 3: JavaScript Function – DOM Manipulation (in same PHP file)
Output: 110 JavaScript is best known for web page development but it is also used in a variety of non-browser environments. You can learn JavaScript from the ground up by following this JavaScript Tutorial and JavaScript Examples. PHP is a server-side scripting language designed specifically for web development. You can learn PHP from the ground up by following this PHP Tutorial and PHP Examples. Can you mix JavaScript and PHP?Besides, PHP and JavaScript similarities, these two languages are a powerful combination when used together. Large numbers of websites combine PHP and JavaScript – JavaScript for front-end and PHP for back-end as they offer much community support, various libraries, as well as a vast codebase of frameworks.
Does JavaScript work with PHP?JavaScript can also talk with your PHP code on the web server whenever it needs to update something (either on the server or on the web page).
How can I enable JavaScript in PHP?You can try with 2 metod:. setting cookies with JS and detecting them from PHP.. creating a form with a hidden field and an empty value; and then assigning some value to it with JS, if the field gets the value – JS is ON, otherwise it's off.. |