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

Do you know what is the use of rand() in php?

0 Answers  


How to delete a file from the system?

0 Answers  


suppose if u want to pass session value using cookies onlu.. what changes i've to made in php.ini file?

1 Answers  


How break and continue while loop in php?

0 Answers  


How can we convert the time zones using PHP?

1 Answers  






How to protect special characters in query string?

0 Answers  


What is the best practice for running mysql queries in php? Consider the risk of sql injection.

0 Answers  


Explain me what is sql injection?

0 Answers  


How do i explode this string '||25||34||73||94||116||128' i need to have a array like this array ( 0 => '25', 1 => '34', 2 => '73', 3 => '94', 4 => '116', 5 => '128' ) explode("||", $array); didnt work for me i get this array array ( 0 => '', 1 => '25', 2 => '34', 3 => '73', 4 => '94', 5 => '116', 6 => '128', )

2 Answers  


Which one is best framework for php?

0 Answers  


How many types of php are there?

0 Answers  


What is the php function that removes the last element of the array and returns it?

0 Answers  


Categories