First of all I'm not prototype expert, rather newbie ;)

1) why do you use onsubmit="validatethis();">  if you can use  $

2) you don't have to set asynchronous:true - it's default value

3) most common is  parameters: $('formlinks').serialize(true) than
using postBody

4) use  parameters: { dept: $F('dept'), reg: $F('reg') } instead of
this long  postBody:'dept='+department+'&reg='+region ...this looks
really bad !!! ;)

you can also try to use $('formname').serializeElements( elements
selection go here)

for example $('formname').getInputs('text') which selects all input
textfields from the same form or something similar ...you can use
Element.select() or $$() if these elements have something in common
(like class, type etc.) - any group of elements can go into

5) where do you use mlprerresult variable? cause there is quite big
chance that you don't have this variable set by ajax request cause
before loadMenu() is called

6) as far as I understand logic of  this app it would be better to
call  loadmenu(); inside reportresult(); than it's sure it is called
only after success of  ajax request

7) can't you get this data from 'site/traderhomecenter.php' or 'site/
adminhomecenter.php in response of first ajax request already? are
the  values  $F('mlptrader'); $F('mlpdepartment');  etc. from form

if yes... you passed it all to the server already in first ajax
request ... so can't you make one more php file which will calls
'Admin/editmylinks2' inside and instead of returning just 'good'
returns result of traderhomecenter.php or adminhomecenter.pl? or just
change editmylinks2 to return this?

you can send "good" if you want is x-json header of the same ajax
response and in the body you can send html which you want to use to
update " MiddleContent'

simple example of php
$response = array ('good'=>true);
header('X-JSON: ('.json_encode($response).')');
if ($_POST('mlptrader'))
   die (variable with html you get from traderhomecenter);
   die (variable with html you get from adminhomecenter);
and then in javascript

function reportresult(transport) {
        var good = transport.headerJSON.good;
        if (good){
                document.getElementById("mlprerresult").innerHTML =
'Your request
completed successfully';

//instead of ajax updater just update $('Middle Contect').innerHTML
here with what you have in transport.responseText
                document.getElementById("mlprerresult").innerHTML =
'Your request

These are my thought to make it easier but I'm not sure I understand
correctly logic of your application.


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 prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to