"Karl Guertin" <[EMAIL PROTECTED]> writes:
> First, you probably want to use loadJSONDoc() rather than
> doSimpleXMLHttpRequest(). The latter returns the actual request
> object, which has the request result as a parameter while the former
> will return the data structure you're passing via JSON. You may be
> confused about the signatures not matching what you're doing. Think of
> JS as having an automatic *arguments parameter on every function and
> loadJSONDoc passes them all to doSimple.
Hmmm... I'm using the following here:
var getAnalisesToxicologia = function () {
var xmlHttpReq = getXMLHttpRequest()
xmlHttpReq.open("POST", "/toxicologia/obterAnalises", true);
xmlHttpReq.setRequestHeader('Content-Type',
'application/x-www-form-urlencoded');
var d = sendXMLHttpRequest( xmlHttpReq, "tipo_id=" +
escape(getElement("form_tipo_id").value));
d.addCallbacks(gotMetadata, metadataFetchFailed);
};
and then:
var gotMetadata = function (oData) {
var payload = evalJSONRequest(oData);
(create 2 DOM objects)
for (indice in payload.analises) {
var analise = payload.analises[indice];
(populate 2 DOM objects)
}
# Replace what I have with what I created
swapDOM('form_available_id', novo_disponivel);
swapDOM('form_selected_id', novo_fazer);
};
Would it be better to use loadJSONDoc() as well?
TIA,
--
Jorge Godoy <[EMAIL PROTECTED]>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" 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/turbogears
-~----------~----~----~----~------~----~------~--~---