Pārlūkot izejas kodu

修改表单提交

jun 4 mēneši atpakaļ
vecāks
revīzija
bde069eeae

+ 29 - 0
public/static/Admin/js/edu_admin.js

@@ -312,7 +312,36 @@ $(function(){
 		// 阻止事件冒泡
 		return false;
 	})
+	//表单action提交
+	$(document).on('submit','.action-form',function() {
+		/* 关闭禁用,保证数据能正常上报*/
+		is_disabled(false);
+		// 处理数据与路径方式
+		var data 	= $(this).serialize();
+		var action 	= $(this).attr('action');
+		var method 	= $(this).attr('method');
+		// 发送
+		$.ajax({
+			type: method,
+			url: action,
+			data: data,
+			dataType: 'json',
+			success: function(data) {
+				art_dialog(data);
+			},
+			error: function(response) {
+				art.dialog({
+					content: response.responseJSON.message,
+					lock: true,
+					ok: function() {
 
+					}
+				});
+			}
+		});
+		// 阻止事件冒泡
+		return false;
+	})
 	$(function(){
 		$('.modal_show').click(function(){
 			// 获取链接

+ 1 - 1
resources/views/admin/poster/index.blade.php

@@ -3,7 +3,7 @@
 	style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 @endsection
 @section('content')
-	<form class="" action="get_poster" method="post">
+	<form class="action-form" action="get_poster" method="post">
 		<div class="form-group col-sm-12">
 			<label class="control-label">海报主图</label>
 			<div id="thumb">