Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

Extracting Values from Javascript for Conversion to Another Language

javascript values



12:28 am on Mar 17, 2012 (gmt 0)

Hi everybody. Hoping I'm at the correct dept. i just put a sample page together with scriptaculous coding for sorting list items and though I got the basic script to work it left me at a loss for updating the mysql database with the new values. I did a mega search on the subject and did find a couple examples using php to do this but the problem is I'm using perl. How does one extract the new values out of the javascript code for converting them to perl (so I can move on the the next challenge updating the database)?
I'm totally at a loss with javascript and not all that well versed at perl either but I am beginning a major study on javascript/ajax.


5:03 am on Mar 17, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

The same javascript should work for both php and perl.

The results will be returned as part of the GET or preferably POST request. How you extract the results (get or post parameters) on the server will differ.

Change the .php in the url to whatever perl expects.


1:20 am on Mar 19, 2012 (gmt 0)

Trial and more error
I'm using the following javascript along with the scriptaculous.js and prototype.js:

<script type="text/javascript">
function updateOrder(){
var options = {
method : 'post',
parameters : Sortable.serialize('firstlist')
new Ajax.Request('g2.pl', options);
Sortable.create('firstlist', {constraint:'vertical', onUpdate : updateOrder});

What would be the variable names getting passed through the post method? Seems no matter what I try I can't get the variable values returned.


6:13 am on Mar 19, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

new Ajax.Request('g2.pl', options);

This results in the parameters being sent in the body of the post rather than as part of the url.

So either read the post body on the server or change to

new Ajax.Request('g2.pl?list='+encodeURIComponent(Sortable.serialize('firstlist')), options);

Featured Threads

Hot Threads This Week

Hot Threads This Month