Created
September 11, 2013 14:01
-
-
Save faizalpribadi/6524010 to your computer and use it in GitHub Desktop.
Simple Example About AMD JS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title></title> | |
</head> | |
<body> | |
<h1>Hello <span class="name"></span></h1> | |
<script> | |
var require = { | |
paths: { | |
jquery: '../javascript/vendor/jquery' | |
} | |
}; | |
</script> | |
<script data-main="resources/javascript/main" src="resources/javascript/vendor/require.js"></script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require(['jquery'], function($) { | |
"use strict"; | |
$(function() { | |
var name = prompt('what is you are name ?'); | |
$('.name').text(name); | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
the directory for `libs` javascript vendor | |
`resources/javascript/vendor/jquery.js | require.js` | |
1. `jquery` | |
2. `require js` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment