Created
June 11, 2011 09:15
-
-
Save tokkonopapa/1020402 to your computer and use it in GitHub Desktop.
/echo/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
/* /echo/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
<div id="result">3秒後に赤に変わります</div> |
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() { | |
// JavaScript コード (長いコードを一旦関数でくくる) | |
var code = function() { | |
$('#result').css('color', 'red'); | |
} | |
// 関数オブジェクトを文字列、実行形式に変換し、URL エンコードする | |
var script = encodeURIComponent("(" + code.toString() + ")();"); | |
// cache を有効にしないと {"_", "123456..."} が入る | |
$.ajaxSetup({ | |
cache: true | |
}); | |
// JavaScript をロードし、実行する | |
$.getScript("/echo/js/?delay=3&js=" + script).complete(function(jqXHR, statusText) { | |
console.log(statusText, jqXHR); | |
}); | |
}); |
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
name: /echo/js/ | |
description: /echo/js/ のテスト | |
authors: | |
- tokkonopapa | |
resources: | |
- https://getfirebug.com/firebug-lite-debug.js | |
normalize_css: yes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment