Hi,

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

1) why do you use onsubmit="validatethis();">  if you can use  $
('formlinks').observe('submit',validatethis);

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
serializeElements()

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
'formlinks'?

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);
else
   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
        }else
                document.getElementById("mlprerresult").innerHTML =
'Your request
failed!!!';
-----------------

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

Quleczka


--~--~---------~--~----~------------~-------~--~----~
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 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to