Skip to content

Instantly share code, notes, and snippets.

@msurguy
Created February 9, 2014 00:38
Show Gist options
  • Save msurguy/8892536 to your computer and use it in GitHub Desktop.
Save msurguy/8892536 to your computer and use it in GitHub Desktop.
Example of extracting JS files for AJAX in Laravel
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>AJAX</title>
</head>
<body>
...
<script src="https://code.jquery.com/jquery-1.10.2.min.js"></script>
<script type="text/javascript">
var ServerRoot = '{{ url("/") }}';
</script>
<script src="js/script.js"></script>
</body>
</html>
$(function() {
$.ajax({
url: ServerRoot+'/posts'
})
.done(function( data ) {}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment