Last active
January 2, 2016 07:19
-
-
Save fdv/8269540 to your computer and use it in GitHub Desktop.
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
# Dans mon controleur | |
respond_to do |format| | |
format.js { | |
render 'autosave' | |
} | |
end | |
# Ma vue | |
<%= javascript_tag "alert('All is good');" %> | |
# Le code JS renvoyé à mon navigateur selon Firebug | |
# Code jamais exécuté | |
<script type="text/javascript"> | |
//<![CDATA[ | |
alert('All is good'); | |
//]]> | |
</script> | |
# HTTP headers | |
Cache-Control max-age=0, private, must-revalidate | |
Connection close | |
Content-Type text/javascript; charset=utf-8 | |
Etag "3040436e8c478e9f41e71e821327d8ed" | |
Server thin 1.6.1 codename Death Proof | |
Set-Cookie _publify_blog_session=blablablablabla; path=/; HttpOnly | |
X-Request-Id c85b8a7b08158c82d74f766ad105cec0 | |
X-Runtime 0.047283 | |
x-ua-compatible IE=Edge,chrome=1 | |
# Appel AJAX | |
function autosave_request(e) { | |
$('#article_form').keyup(function() { | |
typewatch(function() { | |
submit_article_form(); | |
$.ajax({ | |
type: "POST", | |
url: '/admin/content/autosave', | |
data: $("#article_form").serialize(), | |
dataType: "JSON"}); | |
}, 1000) | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment