Page is a not externally linkable
LinusIT - 8:17 am on Aug 28, 2012 (gmt 0)
I messed about with this some more yesterday and found that it doesn't actually work. The page is loaded, the session is set using the ajax request but until the page is refreshed it doesn't know about the session. I've got it working now, i'll post the code incase anyone else finds it useful
Javascript
success: function(html) {
if (html.error) {
$("#search-form").html("<div class=\"warning\">No Results Found</div>" );
} else {
$("#search-form").html("<p><span class=\"label\">Date:</span> " + html.date + "</p>" +//);
"<p><span class=\"label\">Reference:</span> " + html.ref + "</p>" + //);
"<p><span class=\"label\">Amount:</span> " + html.amount + "</p>" + //);
"<p><span class=\"label\">Detail:</span> " + html.detail + "</p>");
}
}
PHP
if ($num_rows > 0) {
$arr = array("date" => $date, "ref" => $ref, "amount" => $amount, "detail" => $detail);
echo json_encode($arr);
} else {
$arr = array("error" => "No Result Found");
echo json_encode($arr);
}