Changing value of an html element from php function [duplicate] The Next CEO of Stack OverflowWhat is the difference between client-side and server-side programming?How to pass JavaScript variables to PHP?Send JavaScript variable to PHP variableHow to pass data from Javascript to PHP and vice versa?Pass javascript variable to php code?What are valid values for the id attribute in HTML?PHP: Delete an element from an arrayConvert HTML + CSS to PDF with PHP?Set a default parameter value for a JavaScript functionHow can I set the default value for an HTML <select> element?How Do You Parse and Process HTML/XML in PHP?Limit file format when using <input type=“file”>?Redirect from an HTML pageHow do I remove a particular element from an array in JavaScript?Why shouldn't I use mysql_* functions in PHP?

Is it possible to replace duplicates of a character with one character using tr

Is a distribution that is normal, but highly skewed considered Gaussian?

Is there a difference between "Fahrstuhl" and "Aufzug"

Which one is the true statement?

Why didn't Khan get resurrected in the Genesis Explosion?

Why doesn't UK go for the same deal Japan has with EU to resolve Brexit?

RigExpert AA-35 - Interpreting The Information

Can we say or write : "No, it'sn't"?

A Man With a Stainless Steel Endoskeleton (like The Terminator) Fighting Cloaked Aliens Only He Can See

What did we know about the Kessel run before the prequels?

Are police here, aren't itthey?

Writing differences on a blackboard

Why do remote US companies require working in the US?

Do I need to write [sic] when a number is less than 10 but isn't written out?

How do I align (1) and (2)?

A small doubt about the dominated convergence theorem

How to get from Geneva Airport to Metabief, Doubs, France by public transport?

Math-accent symbol over parentheses enclosing accented symbol (amsmath)

I want to delete every two lines after 3rd lines in file contain very large number of lines :

Why is the US ranked as #45 in Press Freedom ratings, despite its extremely permissive free speech laws?

0 rank tensor vs 1D vector

The past simple of "gaslight" – "gaslighted" or "gaslit"?

Is it ever safe to open a suspicious HTML file (e.g. email attachment)?

How to prove a simple equation?



Changing value of an html element from php function [duplicate]



The Next CEO of Stack OverflowWhat is the difference between client-side and server-side programming?How to pass JavaScript variables to PHP?Send JavaScript variable to PHP variableHow to pass data from Javascript to PHP and vice versa?Pass javascript variable to php code?What are valid values for the id attribute in HTML?PHP: Delete an element from an arrayConvert HTML + CSS to PDF with PHP?Set a default parameter value for a JavaScript functionHow can I set the default value for an HTML <select> element?How Do You Parse and Process HTML/XML in PHP?Limit file format when using <input type=“file”>?Redirect from an HTML pageHow do I remove a particular element from an array in JavaScript?Why shouldn't I use mysql_* functions in PHP?










-1
















This question already has an answer here:



  • How to pass JavaScript variables to PHP?

    12 answers



  • What is the difference between client-side and server-side programming?

    5 answers



  • Send JavaScript variable to PHP variable [duplicate]

    3 answers



  • How to pass data from Javascript to PHP and vice versa?

    7 answers



  • Pass javascript variable to php code? [duplicate]

    5 answers



I know seems a joke, but i have this situation (resumed):



In index.php i have an element:



<div><font color="white"><span id="codeNumber">codeNumber</span></font></div>


i also have a button. when the button is clicked, i call to a javascript function in a .js file.



This function in the javascript file make e call to a function in a php file passing some parameters in order to use a db and get a value.



My question is:
How to change from the php function the value of the id "codenumber" in the html?



Thanks in advance










share|improve this question













marked as duplicate by miken32, Nick php
Users with the  php badge can single-handedly close php questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Mar 8 at 1:28


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.













  • 1





    Show us the code that does the AJAX and also the PHP

    – RiggsFolly
    Mar 7 at 16:50






  • 1





    You have to do that in js, after the AJAX call using the data returned to the AJAX call from the PHP. You cannot do it using PHP

    – RiggsFolly
    Mar 7 at 16:54












  • "make e call to a function in a php file" Can you please show how that happens? I'm attempted to vote to close this question as a dup of stackoverflow.com/questions/13840429/… ...

    – Teemu
    Mar 7 at 16:56












  • You don't. Php has no knowledge of the page content once it is in the browser. Have php return the desired value back to javascript, then place it in the DOM with javascript when ajax resolves.

    – mopsyd
    Mar 7 at 18:49











  • @RiggsFolly, can you set your comment as answer, please?

    – PeterPam
    Mar 12 at 6:55















-1
















This question already has an answer here:



  • How to pass JavaScript variables to PHP?

    12 answers



  • What is the difference between client-side and server-side programming?

    5 answers



  • Send JavaScript variable to PHP variable [duplicate]

    3 answers



  • How to pass data from Javascript to PHP and vice versa?

    7 answers



  • Pass javascript variable to php code? [duplicate]

    5 answers



I know seems a joke, but i have this situation (resumed):



In index.php i have an element:



<div><font color="white"><span id="codeNumber">codeNumber</span></font></div>


i also have a button. when the button is clicked, i call to a javascript function in a .js file.



This function in the javascript file make e call to a function in a php file passing some parameters in order to use a db and get a value.



My question is:
How to change from the php function the value of the id "codenumber" in the html?



Thanks in advance










share|improve this question













marked as duplicate by miken32, Nick php
Users with the  php badge can single-handedly close php questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Mar 8 at 1:28


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.













  • 1





    Show us the code that does the AJAX and also the PHP

    – RiggsFolly
    Mar 7 at 16:50






  • 1





    You have to do that in js, after the AJAX call using the data returned to the AJAX call from the PHP. You cannot do it using PHP

    – RiggsFolly
    Mar 7 at 16:54












  • "make e call to a function in a php file" Can you please show how that happens? I'm attempted to vote to close this question as a dup of stackoverflow.com/questions/13840429/… ...

    – Teemu
    Mar 7 at 16:56












  • You don't. Php has no knowledge of the page content once it is in the browser. Have php return the desired value back to javascript, then place it in the DOM with javascript when ajax resolves.

    – mopsyd
    Mar 7 at 18:49











  • @RiggsFolly, can you set your comment as answer, please?

    – PeterPam
    Mar 12 at 6:55













-1












-1








-1









This question already has an answer here:



  • How to pass JavaScript variables to PHP?

    12 answers



  • What is the difference between client-side and server-side programming?

    5 answers



  • Send JavaScript variable to PHP variable [duplicate]

    3 answers



  • How to pass data from Javascript to PHP and vice versa?

    7 answers



  • Pass javascript variable to php code? [duplicate]

    5 answers



I know seems a joke, but i have this situation (resumed):



In index.php i have an element:



<div><font color="white"><span id="codeNumber">codeNumber</span></font></div>


i also have a button. when the button is clicked, i call to a javascript function in a .js file.



This function in the javascript file make e call to a function in a php file passing some parameters in order to use a db and get a value.



My question is:
How to change from the php function the value of the id "codenumber" in the html?



Thanks in advance










share|improve this question















This question already has an answer here:



  • How to pass JavaScript variables to PHP?

    12 answers



  • What is the difference between client-side and server-side programming?

    5 answers



  • Send JavaScript variable to PHP variable [duplicate]

    3 answers



  • How to pass data from Javascript to PHP and vice versa?

    7 answers



  • Pass javascript variable to php code? [duplicate]

    5 answers



I know seems a joke, but i have this situation (resumed):



In index.php i have an element:



<div><font color="white"><span id="codeNumber">codeNumber</span></font></div>


i also have a button. when the button is clicked, i call to a javascript function in a .js file.



This function in the javascript file make e call to a function in a php file passing some parameters in order to use a db and get a value.



My question is:
How to change from the php function the value of the id "codenumber" in the html?



Thanks in advance





This question already has an answer here:



  • How to pass JavaScript variables to PHP?

    12 answers



  • What is the difference between client-side and server-side programming?

    5 answers



  • Send JavaScript variable to PHP variable [duplicate]

    3 answers



  • How to pass data from Javascript to PHP and vice versa?

    7 answers



  • Pass javascript variable to php code? [duplicate]

    5 answers







javascript php html






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 7 at 16:48









PeterPamPeterPam

579




579




marked as duplicate by miken32, Nick php
Users with the  php badge can single-handedly close php questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Mar 8 at 1:28


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









marked as duplicate by miken32, Nick php
Users with the  php badge can single-handedly close php questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Mar 8 at 1:28


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









  • 1





    Show us the code that does the AJAX and also the PHP

    – RiggsFolly
    Mar 7 at 16:50






  • 1





    You have to do that in js, after the AJAX call using the data returned to the AJAX call from the PHP. You cannot do it using PHP

    – RiggsFolly
    Mar 7 at 16:54












  • "make e call to a function in a php file" Can you please show how that happens? I'm attempted to vote to close this question as a dup of stackoverflow.com/questions/13840429/… ...

    – Teemu
    Mar 7 at 16:56












  • You don't. Php has no knowledge of the page content once it is in the browser. Have php return the desired value back to javascript, then place it in the DOM with javascript when ajax resolves.

    – mopsyd
    Mar 7 at 18:49











  • @RiggsFolly, can you set your comment as answer, please?

    – PeterPam
    Mar 12 at 6:55












  • 1





    Show us the code that does the AJAX and also the PHP

    – RiggsFolly
    Mar 7 at 16:50






  • 1





    You have to do that in js, after the AJAX call using the data returned to the AJAX call from the PHP. You cannot do it using PHP

    – RiggsFolly
    Mar 7 at 16:54












  • "make e call to a function in a php file" Can you please show how that happens? I'm attempted to vote to close this question as a dup of stackoverflow.com/questions/13840429/… ...

    – Teemu
    Mar 7 at 16:56












  • You don't. Php has no knowledge of the page content once it is in the browser. Have php return the desired value back to javascript, then place it in the DOM with javascript when ajax resolves.

    – mopsyd
    Mar 7 at 18:49











  • @RiggsFolly, can you set your comment as answer, please?

    – PeterPam
    Mar 12 at 6:55







1




1





Show us the code that does the AJAX and also the PHP

– RiggsFolly
Mar 7 at 16:50





Show us the code that does the AJAX and also the PHP

– RiggsFolly
Mar 7 at 16:50




1




1





You have to do that in js, after the AJAX call using the data returned to the AJAX call from the PHP. You cannot do it using PHP

– RiggsFolly
Mar 7 at 16:54






You have to do that in js, after the AJAX call using the data returned to the AJAX call from the PHP. You cannot do it using PHP

– RiggsFolly
Mar 7 at 16:54














"make e call to a function in a php file" Can you please show how that happens? I'm attempted to vote to close this question as a dup of stackoverflow.com/questions/13840429/… ...

– Teemu
Mar 7 at 16:56






"make e call to a function in a php file" Can you please show how that happens? I'm attempted to vote to close this question as a dup of stackoverflow.com/questions/13840429/… ...

– Teemu
Mar 7 at 16:56














You don't. Php has no knowledge of the page content once it is in the browser. Have php return the desired value back to javascript, then place it in the DOM with javascript when ajax resolves.

– mopsyd
Mar 7 at 18:49





You don't. Php has no knowledge of the page content once it is in the browser. Have php return the desired value back to javascript, then place it in the DOM with javascript when ajax resolves.

– mopsyd
Mar 7 at 18:49













@RiggsFolly, can you set your comment as answer, please?

– PeterPam
Mar 12 at 6:55





@RiggsFolly, can you set your comment as answer, please?

– PeterPam
Mar 12 at 6:55












0






active

oldest

votes

















0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes

Popular posts from this blog

Save data to MySQL database using ExtJS and PHP [closed]2019 Community Moderator ElectionHow can I prevent SQL injection in PHP?Which MySQL data type to use for storing boolean valuesPHP: Delete an element from an arrayHow do I connect to a MySQL Database in Python?Should I use the datetime or timestamp data type in MySQL?How to get a list of MySQL user accountsHow Do You Parse and Process HTML/XML in PHP?Reference — What does this symbol mean in PHP?How does PHP 'foreach' actually work?Why shouldn't I use mysql_* functions in PHP?

Compiling GNU Global with universal-ctags support Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Tags for Emacs: Relationship between etags, ebrowse, cscope, GNU Global and exuberant ctagsVim and Ctags tips and trickscscope or ctags why choose one over the other?scons and ctagsctags cannot open option file “.ctags”Adding tag scopes in universal-ctagsShould I use Universal-ctags?Universal ctags on WindowsHow do I install GNU Global with universal ctags support using Homebrew?Universal ctags with emacsHow to highlight ctags generated by Universal Ctags in Vim?

Add ONERROR event to image from jsp tldHow to add an image to a JPanel?Saving image from PHP URLHTML img scalingCheck if an image is loaded (no errors) with jQueryHow to force an <img> to take up width, even if the image is not loadedHow do I populate hidden form field with a value set in Spring ControllerStyling Raw elements Generated from JSP tagds with Jquery MobileLimit resizing of images with explicitly set width and height attributeserror TLD use in a jsp fileJsp tld files cannot be resolved