| 
									
										
										
										
											2012-04-17 03:34:25 +00:00
										 |  |  | //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(){ | 
					
						
							| 
									
										
										
										
											2012-04-25 09:08:51 +00:00
										 |  |  | 		$("#main-wrap").after("<span id='show_preview'></span>"); | 
					
						
							| 
									
										
										
										
											2012-04-17 03:34:25 +00:00
										 |  |  | 		$.ajax({ | 
					
						
							| 
									
										
										
										
											2012-04-23 09:03:55 +00:00
										 |  |  | 			type: 'PUT', | 
					
						
							| 
									
										
										
										
											2012-04-17 03:34:25 +00:00
										 |  |  | 			url:$(this).attr("href"), | 
					
						
							| 
									
										
										
										
											2012-04-23 09:03:55 +00:00
										 |  |  | 			data:$(this).parents("form").serialize(), | 
					
						
							|  |  |  | 			success: function (msg) { | 
					
						
							|  |  |  | 					$("#"+start_modal_with_id).modal('show'); }, | 
					
						
							|  |  |  | 			error: function(){ | 
					
						
							|  |  |  | 				alert("ERROR"); | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 			});   | 
					
						
							|  |  |  | 			return false; | 
					
						
							|  |  |  | 		}); | 
					
						
							| 
									
										
										
										
											2012-04-17 03:34:25 +00:00
										 |  |  | }); |