I have a code in php where onclick i will call a javascript. but i dont know how to use the ajax and pass the value to php and return it.
<script>
function getURL(e)
{
//ajax code that will check.php
}
</script>
body: main.php (current page) when the user clicked on the link. it will alert correct.
<?php $url = "www.google.com"; ?>
<a href="#" onclick="getURL('<?php echo $url; ?>');">click me</a>
a php that ajax will call.. check.php
<?php
$html = file_get_html($url);
foreach($html->find('iframe') as $e)
echo $e->src;
return "correct" //idk if it's correct to return. should it be echo? ?>
i need to return the result.
May a ask for some sample basic code to call of ajax to php using this? and it will alert the "correct" word. or anything that the php will return. thanks :)