This repository has been archived on 2024-03-16. You can view files and clone it, but cannot push or open issues or pull requests.
orbit-4-1/app/assets/javascripts/inc/modal-preview.js

22 lines
680 B
JavaScript

//Preview need a link in form as Ex and a corresponding PUT action in controller
//Ex preview trigger:
// <%= link_to "NewPreview", realtime_preview_admin_ad_banner_path(ad_banner_tab) , :class=>'preview_trigger'%>
$(document).ready(function() {
$("a.preview_trigger").click(function(){
$(this).after("<span id='show_preview'></span>");
$.ajax({
type: 'PUT',
//async : true,
url:$(this).attr("href"),
contentType: 'application/javascript; charset=utf-8',
data:$(this).parents("form").serialize(),
success: function (msg) {
$("#"+start_modal_with_id).modal('show'); },
error: function(){
alert("ERROR");
}
});
return false;
});
});