Passing an argument to a Javascript function through PHP

user3624383

i'm using PHP to get some values from the Database & echo html code. So i have something like this..

$values = $params->get('something');

And then i want to pass $values in to the doSomething() function of javascript.

echo('<html>');
echo('<head>');
echo('</head>');
echo('<body>');      
echo('<button type="button" onclick="doSomething()">');          
echo('</button>');      
echo('</br>');
echo('</body>');
echo('</html>');

Any suggestions? :D

Sougata Bose

You can do this -

echo('<button type="button" onclick="doSomething(\'' . $values . '\')">'); 

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

passing array as javascript function argument from php

From Dev

php - passing argument to function

From Dev

Passing a function argument through another function in Python

From Dev

Function With/Without Passing an argument - PHP

From Dev

Passing argument through an onchange method in Javascript

From Dev

Passing values through javascript to php

From Dev

Passing function as an argument of another function in PHP

From Dev

Passing div style as a function argument Javascript/ React

From Dev

Passing argument to the function inside the object in Javascript

From Dev

Passing javascript object as an argument to a function - typescript equivalent

From Dev

Trouble passing arguments through an initialiser function in javascript

From Dev

Passing a variable to a function through a button (HTML/Javascript)

From Dev

Javascript passing through formatted int as string to function

From Dev

Passing of function argument through ng-change not working

From Dev

Passing smart pointer to function through non smart pointer argument

From Dev

passing php variable in javascript function

From Dev

Passing javascript/Jquery array to php through a form

From Javascript

Passing JavaScript array to PHP through jQuery $.ajax

From Dev

Passing a JavaScript Array To PHP Through JQuery $.post

From Dev

Issue passing PHP variables through Javascript and back

From Dev

Passing variables through PHP -> Javascript -> AJAX - Options?

From Dev

variable is not passing from javascript to php through ajax

From Dev

Passing A Function As Argument To A Function

From Dev

Passing argument in java through CLI

From Dev

Passing an argument through multiple pages

From Dev

Scala Passing Function with Argument

From Dev

passing colormap as argument to function

From Dev

passing argument to map function

From Dev

Passing function as an argument: Python

Related Related

  1. 1

    passing array as javascript function argument from php

  2. 2

    php - passing argument to function

  3. 3

    Passing a function argument through another function in Python

  4. 4

    Function With/Without Passing an argument - PHP

  5. 5

    Passing argument through an onchange method in Javascript

  6. 6

    Passing values through javascript to php

  7. 7

    Passing function as an argument of another function in PHP

  8. 8

    Passing div style as a function argument Javascript/ React

  9. 9

    Passing argument to the function inside the object in Javascript

  10. 10

    Passing javascript object as an argument to a function - typescript equivalent

  11. 11

    Trouble passing arguments through an initialiser function in javascript

  12. 12

    Passing a variable to a function through a button (HTML/Javascript)

  13. 13

    Javascript passing through formatted int as string to function

  14. 14

    Passing of function argument through ng-change not working

  15. 15

    Passing smart pointer to function through non smart pointer argument

  16. 16

    passing php variable in javascript function

  17. 17

    Passing javascript/Jquery array to php through a form

  18. 18

    Passing JavaScript array to PHP through jQuery $.ajax

  19. 19

    Passing a JavaScript Array To PHP Through JQuery $.post

  20. 20

    Issue passing PHP variables through Javascript and back

  21. 21

    Passing variables through PHP -> Javascript -> AJAX - Options?

  22. 22

    variable is not passing from javascript to php through ajax

  23. 23

    Passing A Function As Argument To A Function

  24. 24

    Passing argument in java through CLI

  25. 25

    Passing an argument through multiple pages

  26. 26

    Scala Passing Function with Argument

  27. 27

    passing colormap as argument to function

  28. 28

    passing argument to map function

  29. 29

    Passing function as an argument: Python

HotTag

Archive