Skip to content

Instantly share code, notes, and snippets.

@svenl77
Last active October 12, 2016 21:15
Show Gist options
  • Save svenl77/61282aea5f9ed41985c868279635cbb1 to your computer and use it in GitHub Desktop.
Save svenl77/61282aea5f9ed41985c868279635cbb1 to your computer and use it in GitHub Desktop.
<?php
Form::open ("test", $values, ["ajax" => "finishCallback"]);
Form::hidden ("id");
From::Button ("Submit");
Form::close ();
?>
<script>
function finishCallback (data) {
console.log (data.status);
console.log (data.message);
}
</script>
<?php
// Reply example
$reply = ["status" => "OK", "message" => "all is good"];
header ("Content-type: application/json");
echo json_encode ($reply);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment