Currently Im trying to build a poll using JQuery.
$('#next').click(function(){
$.ajax({
type:'POST',
url: 'getNextPoll.php?pg=1',
dataType: json,
success: function() {
$("#a .ui-btn-text").text(data.answera);
$("#b .ui-btn-text").text(data.answerb);
$("#c .ui-btn-text").text(data.answerc);
$("#d .ui-btn-text").text(data.answerd);
} // end of success callbac
});
});
I have four buttons with id= a..d. What i was trying to do was bring in the four answer values and put each one in a button. For some reason though it only allows me to get one value $row[0] and nothing else? Can anyone tell me where am i doing wrong?
Thanks for your time.
EDIT: Here's php code
<?php
require_once('connection.php');
require_once('constants.php');
$pg = isset($_GET['pg']) ? $_GET['pg'] : 0;
$nxtPage = $pg++;
$offset = (1 * $pg) - 1;
$result = mysql_query("SELECT * FROM Questions ORDER BY pk_Id DESC LIMIT 1" . " OFFSET " . $offset) or die(mysql_error());
$row = mysql_fetch_array($result, MYSQL_ASSOC);
echo json_encode($row);
?>