From 06ccdba84c4323c137786bb200f8ac4add6ac08e Mon Sep 17 00:00:00 2001 From: Daniel Schmitzer Date: Sat, 11 Aug 2018 08:21:42 +0000 Subject: - Optimierung Bilderauswahl sendeet bei mehreren Bilder nur noch eine Anfrage git-svn-id: https://[internal]/wordpress/plugins/wpsg4@7098 0d5edaf7-2b12-4e95-93f4-047927463d4b --- views/produkt/images.phtml | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'views') diff --git a/views/produkt/images.phtml b/views/produkt/images.phtml index 247b9f9..88522b4 100644 --- a/views/produkt/images.phtml +++ b/views/produkt/images.phtml @@ -189,6 +189,8 @@ //loop through the array and do things with each attachment var i, attachment; + var arPostID = []; + for (i = 0; i < attachments.length; ++i) { attachment = attachments[i]; @@ -196,23 +198,22 @@ attachment = attachment.toJSON(); - console.log(attachment); + arPostID.push(attachment.id); - jQuery.ajax( { - url: 'wp-admin/admin.php?page=wpsg-Produkt&action=ajax&cmd=upload&noheader=1&edit_id=view['data']['id']; ?>', - async: true, - data: { - post_id: attachment.id - }, - success: function(data) { - - jQuery('#produktbilder_target_MT').html(data); + } - } - } ); + jQuery.ajax( { + url: 'wp-admin/admin.php?page=wpsg-Produkt&action=ajax&cmd=upload&noheader=1&edit_id=view['data']['id']; ?>', + async: true, + data: { + post_id: arPostID + }, + success: function(data) { + jQuery('#produktbilder_target_MT').html(data); - } + } + } ); }); -- cgit v1.2.3