Skip to content

Instantly share code, notes, and snippets.

@clouddueling
Created November 13, 2012 17:34
Show Gist options
  • Save clouddueling/4067189 to your computer and use it in GitHub Desktop.
Save clouddueling/4067189 to your computer and use it in GitHub Desktop.
Using Eloquent with Javascript
function get_card($card_id)
{
$card = Card::find($card_id);
$data = array(
'json_card' => json_encode($card),
);
$this->layout->nest( 'content', 'card.form_editor', $data );
}
<script>
$(function() {
var card = {{ $json_card }}.attributes
l(card.id)
l(card)
})
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment