Sending HTTP request with multiple parameters having same name

后端 未结 4 1789
粉色の甜心
粉色の甜心 2020-12-18 03:14

I need to send a HTTP request (and get XML response) from Flash that looks similar to following:

http://example.com/somepath?data=1&data=2&data=3
         


        
4条回答
  •  温柔的废话
    2020-12-18 04:08

    You cannot use loadvars like this - because data can be either 1 or 2 or 3, not all of them at the same time.

    You can either pass it as a comma separated list:

    var req:LoadVars = new LoadVars();
    req["data"] = "1,2,3";
    

    or as an xml string, and parse it at the server. I am not familiar with manipulating xml in AS2, but this is how you'd do it in AS3:

    var xml:XML = ;
    xml.appendChild(1);
    xml.appendChild(2);
    xml.appendChild(3);
    
    //now pass it to loadvars
    req["data"] = xml.toXMLString();
    

    The string you send is:

    
      1
      2
      3
    
    

提交回复
热议问题