English 中文(简体)
POST作为GET
原标题:POST being sent as a GET

I m writing a Flex application that uses HTTPService to communicate with a php script, in order to do a query on a database. Everything works fine if i use a GET request, but it doesn t work with POST. For some odd reason, the php script is actually receiving a GET request instead of POST. Also, it seems not to carry the parameters that i sent from the flex app.

这里是《灵活守则》的一部分:

<mx:HTTPService id="userRequest" url="url" 
                useProxy="false" method="POST" result="checkTransmissionCode()"> 
    <s:request xmlns=""> 
        <transmissionCode>{transmissionCode_TextInput.text}</transmissionCode>              
    </s:request>        
</mx:HTTPService>

private function sendCode() :void{
     userRequest.send();
}

private function checkTransmissionCode() :void {                                                                            
            if(userRequest.lastResult.authorization=="correct"){
                this.currentState= transmission ;
            }
            else{
                Alert.show("Invalid");  
            }
            userRequest.clearResult();                              
        }

I ve already found some other threads of people with a similar problem, but none of them helped me with this... Does anyone knows why this is happening, or have any idea on how to solve this?

问题回答

What you are doing should work. Are there any redirect in place on the server side? I believe those would change the request type from a Post to a Get.

在灵活2天中,在将这种方法归根到吉大港定居地之前,我曾遇到过困难问题,在访问YouTube REST 标语时。 它需要获得请求,但吉大港山区服务公司违约是员额。 我得以通过向GET而不是POST指定一个吉大港山区负责人来解决这一问题。 也许你可以采用同样的方法,但相反。

在发出呼吁之前,就如此:

private function sendCode() :void{
 userRequest.headers[ X-HTTP-Method-Override ] =  POST ;        
 userRequest.send();
}




相关问题
Disable button tooltip in AS3

I want to disable the tooltip on certain buttons. The tooltip manager seems to be an all or nothing solution. Is it possible to disable the tooltip for just one or two buttons?

Multiple Remote call made simultenously

I was making multiple remote calls and they are done sequentially and when I am getting a result event back it s triggering calls to all the methods with ResultEvent as an argument . I am supposed to ...

Attaching a property to an event in Flex/AS3

I have a parameter that needs to be passed along with an event. After unsuccessful attempts to place it on the type by extending the class, I ve been advised in another SO question to write a custom ...

Clearing RSL in Cache

I have built a flex application which has a "main" project and it is assosciated with a few RSL s which are loaded and cached once i run my "main" application. The problem i am facing is that the ...

What s a good way of deserializing data into mock objects?

I m writing a mock backend service for my flex application. Because I will likely need to add/edit/modify the mock data over time, I d prefer not to generate the data in code like this: var mockData =...

AS3 try/catch out of memory

I m loading a few huge images on my flex/as3 app, but I can t manage to catch the error when the flash player runs out of memory. Here is the what I was thinking might work (I use ???? because i dont ...

热门标签