You need to have an application set up on your server to receive a request from the page, process it, and return a value. The example I gave was extracted from a working application. There is a server side component to my solution that would not make any sense to you because it has nothing to do with your application. Your application surely must have some local equivalent, otherwise how are you getting the rest of the list of elements to show on the page in the first place?
In pseudocode, here's what my server-side application does: On page load: Query the database, get a list of the elements in the table foo, in the order of their position column. Turn that into HTML, and inject into the page template. On receipt of a POST from the page asking for a new ID: Insert into the database, creating a new row in the table foo, get the auto-number ID column value, and return that as ResponseText to the requesting browser. On receipt of a POST from the page containing a new sort order: Iterate over the POST['sort_order'] in order, updating the foo table with the new order by setting the position column to match the key of that array. All three of these things are done by one script in my application, your mileage will necessarily vary. Walter On May 25, 2009, at 7:23 AM, WLQ wrote: > > Seems like I can't connect your script, I made to divs with cart and > timeline. But nothing happens, can you tell me what else to create > apart of javascript? > > On 24 Maj, 18:45, Walter Lee Davis <[email protected]> wrote: >> Could you post an example of what you're trying to run on Pastie or >> jsbin and indicate what errors you're seeing in Firebug? I extracted >> the code I posted from a working page, but I may have messed some >> things up in trying to simplify it as an example (removing locally >> important things that would only be confusing for your use-case). >> >> Walter >> >> On May 24, 2009, at 11:56 AM, WLQ wrote: >> >> >> >>> I can't get your script to work, don't know why... >> >>> On 5 Maj, 20:21, Walter Lee Davis <[email protected]> wrote: >>>> You have to ask the database for the next ID by creating a new >>>> record >>>> and reading its response. That's what the Ajax Request bit was in >>>> my >>>> example. When you drop, it asks the database for a new widget, and > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~----------~----~----~----~------~----~------~--~---
