Could anyone just help me out with this. I'm trying to get my AJAX to simply echo what's in my php file when a click a link:
AJAX:
$(document).ready(function(){
$("#gentest").click(function(e){
e.preventDefault();
$.getJSON("char_con.php?", {act: 'char_con'}, function(data){
$(".x").html(data);
});
});
});
<div class="box">
<a href="#" id="gentest">Generate Quote</a>
<div class="x">TEST</div>
</div>
my PHP file:
<?php
if($_GET['act'] == "char_con") {
$strA ='
<div id="dark_ad"><img src="img/data/under_ad.png" alt="Click here to begin"></div>
<div id="con_sep"></div>
';
}
else
{
$strB ='
<a href="index.php?act=gen_con"><img src="img/vpbg/vpbgt.png" alt="Click here to begin"></a>
';
}
?>
I'm pretty sure I have the AJAX bit down but would anyone tell me how to get it to actually echo the php? I'm a bit lost.
Thanks for any help.