on clientside(js) im using this script
jQuery.ajax({
type: "GET",
url: "editold.php",
data: "call=generateCode",
success: function (response) {
alert("Succesful getting php file");
},
error: function (response) {
alert("Error getting php file");
}
});
on serverside(php) im using this code:
<?php
if($_SERVER['REQUEST_METHOD']=="GET") {
echo '<script type="text/javascript">' . 'alert(" ' . 'hey' . '");' . '</script>';
$function = $_GET['call'];
if(function_exists($function)) {
call_user_func($function);
}
else {
echo 'Function Not Exists!!';
}
}
function generateCode() {
echo '<script type="text/javascript">' . 'alert(" ' . 'hey' . '");' . '</script>';
}
?>
Although I do get an alert saying my success function alert meaning the file was loaded succesfully I dont seem to be getting the final generatecode function to work.(I dont get a second alert.)
i've tried lots of things but nothing seems to work.
What do i do?..
"call=generateCode". After further thought, it doesn't need to be an object, but I still question your implementation.