Is there any way to call a JAVASCRIPT function in PHP in AJAX
Answers were Sorted based on User's Feedback
Answer / arya
<?php
$str = '<script language="javascript">
function get_pop_up()
{
alert("This is a way to call JAVASCRIPT function in PHP");
}
</script>
<input type="button" name="Click" value="Click"
onclick="get_pop_up();">
';
echo $str;
?>
Is This Answer Correct ? | 15 Yes | 3 No |
Answer / ashiq
yes , who say no
definite their is way to call javascript function when
calling ajax, ajax execute php script and with in the ajax
commmand we can call after ajax function which execute the
javascript function code
examaple
if (request.readyState == 4)
{
if (request.status == 200)
{
data=request.responseText;
document.getElementById
(_dynCont).innerHTML=data;
try
{
jSFromAjax
(varbol=true,varStr='');
}
catch(ex){}
}
}
this is the function that execute the js with ajax
Is This Answer Correct ? | 14 Yes | 4 No |
Answer / guest_shah
in php u can call javascript function in onlclick or onchange
event of html tag.or u can call like
?><script language='javascript'>
javascriptfunction
</script>
<?
Is This Answer Correct ? | 3 Yes | 13 No |
Which is the best institute in Chennai to learn PHP? Please help.
What is difference between php and html?
How do you format and output a number with leading zero's?
How to Calculate Internal links & External Link in Website.(For Example YAHOO WEBSITE)
What is preg_match?
How to Retrieve a Cookie Value?
What does it mean when it says the csrf token is invalid?
How can we submit from without a submit button?
What are the advantages of using php?
Tell me can the value of a constant change during the script's execution?
What is cookie in php with example?
What is the difference between print() and echo()?