I'm unable to run my php script at the click of the button.
If I run the script via the terminal, 'php get_funny_status.php'
it returns the correct output. However, I'm not able to do this via AJAX. The beginning ajax
alert shows up, but I'm not getting any responseText.
Am I missing something?
EDIT: I am testing this application view Preview Browser in Adobe Dreamweaver (I'm not sure if this has anything to do with the issue)
<script>
$( document ).ready(function() {
$( ".nextStatus" ).click(function() {
alert('beginning ajax');
var statusNumber = '5';
$.get('get_funny_status.php?' + statusNumber, function(responseText) {
alert(responseText);
});
});
});
</script>
Here's my php script:
<?php
//initialize DB stuff
$status_text_query = "SELECT * FROM funny_status WHERE STATUS_NUM = '". $_GET['statusNumber']."'";
$result = mysql_query($status_text_query);
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo 'num likes: ' . $row['NUM_LIKES'];
echo 'num dislikes: ' . $row['NUM_DISLIKES'];
echo 'status text: ' . $row['STATUS_TEXT'];
echo 'status num: ' . $row['STATUS_NUM'];
}
?>