Is there any way to call a JAVASCRIPT function in PHP in AJAX

Answers were Sorted based on User's Feedback



Is there any way to call a JAVASCRIPT function in PHP in AJAX..

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

Is there any way to call a JAVASCRIPT function in PHP in AJAX..

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

Is there any way to call a JAVASCRIPT function in PHP in AJAX..

Answer / ravi

No

Is This Answer Correct ?    16 Yes 9 No

Is there any way to call a JAVASCRIPT function in PHP in AJAX..

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

Post New Answer

More PHP Interview Questions

how to send mail in php but mail should be send in inbox not in spam.....:(

2 Answers   ATS,


How do you display the output directly to the browser?

0 Answers  


What are the ways to define a constant in php?

0 Answers  


Is php fully object oriented?

0 Answers  


Do csrf tokens expire?

0 Answers  






How many ways are there for passing variables between pages in PHP and what are they ?

10 Answers  


What is the difference between mysql_connect and mysql_pconnect ? Which one is good in terms of performance ?

4 Answers  


Tell me what is use of in_array() function in php?

0 Answers  


How to remove leading and trailing spaces from user input values?

0 Answers  


How to avoid the undefined index error?

0 Answers  


what is the dirrence in PHP4 & PHP5 . ?

8 Answers  


What is inheritance in php?

0 Answers  


Categories