Hey I have a question about how LoadVars assigns variables and posts them to PHP pages. I’m loading the variables through an XML object and here’s the XML(its @ the bottom of the page).
Here’s my problem: There can be multiple services in the services sub-tree depending upon how many services have been added to the XML file. This XML has only one service and I assign each node to a LoadVars object and then load those to the PHP. This works fine, but if I have a <record> node with more than one serviceId, I can’t get it to POST the variables properly because the name is explicitly linked to the object…
Like I tried doing this:
for(var k=0;k<(my_xml.firstChild.childNodes*.childNodes[5].childNodes.length)/3; k++){
var serv_id_field = String("servId+k");
var serviceIdField = eval(serv_id_field);
varSender.serviceIdField=my_xml.firstChild.childNodes*.childNodes[5].childNodes[3*k];
}
Then I load the variables but instead of loading servId0 when k=0, it loads the string “serviceIdField=somevalue”… I need the number of variables to be sent to be generated on the fly. Someone Please HELP!!
THX
* <?xml version="1.0" encoding="UTF-8" ?>
- <records>
- <record>
* <custId>0000</custId>
* <custName />
* <custAddress />
* <zoneId>565</zoneId>
* <active>true</active>
- <services>
* <servId>3454</servId>
* <servDesc />
* <servAmount />
* </services>
- <workIds>
* <workPerformId>4455</workPerformId>
* <workDate />
* <amount />
* </workIds>
* </record>