How to use Javascript in PHP?

Arul Prakash

Arul Prakash

@arul-prakash-YCBAuT Oct 19, 2024
how can i use java scripts in PHP

Replies

Welcome, guest

Join CrazyEngineers to reply, ask questions, and participate in conversations.

CrazyEngineers powered by Jatra Community Platform

  • Ankita Katdare

    Ankita Katdare

    @abrakadabra Jul 5, 2012

    #-Link-Snipped-# What is it that you want to do? Please ask specific questions.
    Else this will help -
    <a href="https://www.itamer.com/using-php-and-javascript-together/278/" target="_blank" rel="noopener noreferrer">Using PHP and Javascript together – iTamer</a>
  • siraj.mussafirr

    siraj.mussafirr

    @sirajmussafirr-UMGx7y Jul 8, 2012

    Make clear the question. Do you want to load a php file and run javascript on the client browser ? Or do you wish to run javaScript at Server side?
  • Arul Prakash

    Arul Prakash

    @arul-prakash-YCBAuT Jul 9, 2012

    want to load a php file and run javascript on the client browser
  • Uday Bidkar

    Uday Bidkar

    @uday-bidkar-X1y63x Jul 13, 2012

    Whatever you write outside the php delimiters (most commonly used open/close delimiters are "<?php" and "?>") does not get processed by the PHP processor at server end and gets sent directly to the client as it is. So you can embed the javascript directly in your PHP file or can also point to external js file as you would do in plain HTML, outside the PHP delimiters
  • siraj.mussafirr

    siraj.mussafirr

    @sirajmussafirr-UMGx7y Jul 28, 2012

    Just print out the link for JS in the same way you do with HTML.

    This is a basic code snippet this would probably do:
    <?php
    echo "<script type='text/javascript' src='filename.js'/>";
    ?>
  • Arul Prakash

    Arul Prakash

    @arul-prakash-YCBAuT Aug 15, 2012

    thank you dude....!