/    Sign up×
Community /Pin to ProfileBookmark

Drag & Drop – Scriptaculous – Wait to make post request

Hi.

I am using Scriptaculous to create drag and drop functionality. I pasted the code I am using below. It’s functions almost exactly how the example on their website works. I would like to remove/change the onUpdate function so that it does not contact the server each time an item is dropped, I would rather have the script store it in an array or object that will be sent to process [I]after[/I] the user has finished dragging and dropping all of the elements. Problem is, I can’t seem to wrap my brain around how to start this one. If anyone knows how I could accomplish this – or even give me a good place to start, that would be great!!!

Thanks for reading,
-Mike

[CODE] Sortable.create(
“<?php print MF_SORT_GALLERY_CONTAINER; ?>”, {
tag:’div’,
overlap:’horizontal’,
constraint: false,
onUpdate:function(){
new Ajax.Updater(
‘mfTalkBack’, // html element ID to feed AJAX response data into.
‘<?php print MF_SORT_GALLERY_AJAX_DOC; ?>’, // server-side script that handles request
{
onComplete: function(request){ new Effect.Highlight(‘ajaxResponseBox’,{endcolor:’#00ff00′, restorecolor:’#00ff00′}); },
parameters: Sortable.serialize(‘<?php print MF_SORT_GALLERY_CONTAINER; ?>’),
evalScripts: true,
asynchronous: true,
//onLoading: function(request){ new Effect.Highlight( ‘ajaxResponseBox’, {startcolor:’#ffffff’, endcolor:’#0000ff’, restorecolor:’#0000ff’} ); },
onFailure: function(request){ new Effect.Highlight( ‘ajaxResponseBox’, {startcolor:’#ffffff’, endcolor:’#ff0000′} ); }
}
)
}
}
)[/CODE]

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @mfields spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...