I'm watching Firebug and the responses from my php backend which is
returning either XML or JSON and I am seeing a second response from my
PHP back-end.  The first (at least what I assume is the first) request
gets a valid response and I update the DOM accordingly.  Then shortly
there after I witness a second request with an empty POST, my PHP back-
end responds accordingly... in this case $_POST was empty so I return
an error in a JSON string.  But I've already handled an onSuccess
event so my client script doesn't do anything.  Below is my function
called by an onClick event from a button in the DOM.

Can some one point out to me why there is at least a second request
being made AFTER the onSuccess?

cnt = 0;

function selectCompositeList(thisform) {
        try {
                var url = apphome + 'screening/compositelists/
process_hwi_compositelists.php';
                var frm = thisform.serialize(true);
                frm.action = 'GET_HEADERS';

                var ajaxReq = new Ajax.Request ( url,
                        {
                                parameters: frm,
                                onSuccess: function(transport, json) {
                                        try {
                                                
while($('hwiCompositeList_headers').childNodes[0]) {
                                                        
$('hwiCompositeList_headers').removeChild($
('hwiCompositeList_headers').childNodes[0]);
                                                }

                                                var respObj = 
transport.responseText.evalJSON();
                                                var lvgrd = 
$('hwiCompositeList');

                                                var hdtr = 
$('hwiCompositeList_headers');

                                                for (var k=0; k < 
respObj.cols.length; k++){
                                                        var hdtd = 
document.createElement('td');
                                                        hdtdtxt = 
document.createTextNode(respObj.cols[k]);
                                                        
hdtd.appendChild(hdtdtxt);
                                                        hdtr.appendChild(hdtd);
                                                }
                                                clearMessages();
                                                // this block of code is here 
for debugging purposes only at
this point...
                                                // i intend on calling a second 
function for a second Ajax call
using the respObj.id in the requestParemeters
                                                var div = $('messages');
                                                var dvclid = 
document.createTextNode("clid: " + respObj.id  +
"<br />cnt: " + cnt++ );
                                                
$('messages').appendChild(dvclid);

                                        } catch (err) {
                                                clearMessages();

                                                var divmsg = $('messages');

                                                while(divmsg.childNodes[0]){
                                                        
divmsg.removeChild(divmsg.childNodes[0]);
                                                }

                                                var errors = 
document.createTextNode(err);
                                                divmsg.appendChild(errors);
                                                divmsg.style.display = 'block';
                                        }
                                },
                                onFailure: function() {
                                        clearMessages();
                                        var divmsg = $('messages');
                                        var err = "Could not finish the request 
for a composite list.";

                                        while(divmsg.childNodes[0]){
                                                
divmsg.removeChild(divmsg.childNodes[0]);
                                        }

                                        var errors = 
document.createTextNode(err);
                                        divmsg.appendChild(errors);
                                        divmsg.style.display = 'block';
                                        return false;
                                }
                        }
                        );

                        return false;

        } catch (err) {
                clearMessages();

                var divmsg = $('messages');

                while(divmsg.childNodes[0]){
                        divmsg.removeChild(divmsg.childNodes[0]);
                }

                var errors = document.createTextNode(err);
                divmsg.appendChild(errors);
                divmsg.style.display = 'block';
        }
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to