Last active
August 29, 2015 14:03
-
-
Save wuliupo/d20cc1482af5c1c9d1c2 to your computer and use it in GitHub Desktop.
ScriptInAjax
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
<script type="text/javascript" src="event.js"></script> | |
<link rel="stylesheet" type="text/css" href="style.css"> | |
<script type="text/javascript"> | |
function eventInScript(){ | |
console.log("event In Script"); | |
} | |
</script> | |
<style type="text/css"> | |
.class-in-file{border: 1px solid #F00;} | |
</style> | |
成功加载点击按钮测试是否加载js | |
<button type="button" onclick="eventInFile();" class="class-in-file">event In File</button> | |
<button type="button" onclick="eventInScript();" class="class-in-style">event In Script</button> |
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
function eventInFile(){ | |
console.log("event In File"); | |
} |
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 lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>ScriptInHTML</title> | |
</head> | |
<body> | |
<button type="button" onclick="loadData();" >click me to load data</button> | |
<div id="loading">Loading</div> | |
<script type="text/javascript" src="//code.jquery.com/jquery-latest.js"></script> | |
<script type="text/javascript"> | |
function loadData(){ | |
$.ajax({ | |
url : "data.html", | |
success : function(result) { | |
//TODO how to rend the innerHTML ??? | |
$("#loading").html(result); | |
} | |
}); | |
} | |
</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
.class-in-style{background-color: #F00;} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment