Skip to content

Instantly share code, notes, and snippets.

@tkc
Created August 20, 2015 03:27
Show Gist options
  • Save tkc/670ef12044f2c3bfc7bd to your computer and use it in GitHub Desktop.
Save tkc/670ef12044f2c3bfc7bd to your computer and use it in GitHub Desktop.
window.data
<SCRIPT language="JavaScript">
window.data = {
'user_id':<?php echo Auth::user()->id ?>,
'article_id':<?php echo $article->id ?>
}
</SCRIPT>
@tkc
Copy link
Author

tkc commented Aug 20, 2015

        var data = {
            'user_id': window.data.user_id,
            'article_id': window.data.article_id
        };

        $.ajax({
            type: "POST",
            url: setUrl,
            data: data,
            success: function (message) {
                console.log(message);
            },
            dataType: "html"
        });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment