I'm trying to perform a simple ajax call to a simple php script to test that ajax is working.
HTML:
<button id="hi">hi</button>
JS:
<script type="text/javascript">
$( "#hi" ).click(function(){
var dataString = "hi";
$.ajax({
url: "custom_scripts/hi.php",
type: "POST",
dataType:'json',
data: dataString,
cache: false,
success: function(data){
if(data.auth==true){
alert("success: " + data.auth);
}
}
})
});
PHP:
<?php
$hi=$_POST['hi'];
$rVal=array("auth" => false);
if(isset($hi)){
$rVal['auth']=true;
} else {
$rVal['auth']=false;
}
echo json_encode($rVal);
?>
Are there any other scripts or libraries (from any language) that can interfere with ajax calls? When I step through, it's reaching the call, it's not returning any data (and no error in console) ...