Guest User

Untitled

a guest
Jul 16th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. $(document).ajaxSend(function(event, request, settings) {
  2. if ( settings.type == 'post' ) {
  3. settings.data = (settings.data ? settings.data + "&" : "")
  4. + "authenticity_token=" + encodeURIComponent( AUTH_TOKEN );
  5. request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  6. }
  7. });
  8.  
  9. // When I say html I really mean script for rails
  10. $.ajaxSettings.accepts.html = $.ajaxSettings.accepts.script;
  11.  
  12. $.ajax({
  13. data:'url_to_remote='+encodeURIComponent(URL), url: '/test/path/update_preview', type: 'post', dataType: 'html'
  14. });
Add Comment
Please, Sign In to add comment