スクリプト実行中にライブラリを動的読み込みしたい時とか。
$.getScript('//example.com/ex.js', function(){
// 任意のコード
})
$.getScript()を用いることで、外部JSを動的に読み込むことが出来る。第二引数にてコールバックを指定すれば、スクリプトファイルの読み込み完了後に実行してくれるので非常に便利。
スクリプト実行中にライブラリを動的読み込みしたい時とか。
$.getScript('//example.com/ex.js', function(){
// 任意のコード
})
$.getScript()を用いることで、外部JSを動的に読み込むことが出来る。第二引数にてコールバックを指定すれば、スクリプトファイルの読み込み完了後に実行してくれるので非常に便利。
よく使うレスポンスメモ。
// 301 Moved Permanently
header('Location: http://example.com/', true, 301);
// 302 Found
header('Location: http://example.com/', true, 302);
header('Location: http://example.com/');
// 303 See Other
header('Location: http://example.com/', true, 303);
// 307 Temporary Redirect
header('Location: http://example.com/', true, 307);
// 400 Bad Request
header('HTTP', true, 400);
// 403 Forbidden
header('HTTP', true, 403);
// 404 Not Found
header('HTTP', true, 404);
// 500 Internal Server Error
header('HTTP', true, 500);
// 501 Method Not Implemented
header('HTTP', true, 501);
// 502 Bad Gateway
header('HTTP', true, 502);
// 503 Service Temporarily Unavailable
header('HTTP', true, 503);
// 504 Gateway Time-out
header('HTTP', true, 504);
// 505 HTTP Version Not Supported
header('HTTP', true, 505);
といいつつ後半めったに使わない件。笑