3
I am trying to open a new URL and send variables via method POST
, but it only sends in method GET
. I tried that Code:
// create a URLRequest object with the target URL:
var url : String = 'newpage.html';
var urlRequest : URLRequest = new URLRequest(url);
// create a URLVariables object and add all the values you want to send with their identifiers:
var urlVariables : URLVariables = new URLVariables();
urlVariables['formfieldId'] = 'formfieldValue';
// add the urlVariables to the urlRequest
urlRequest.data = urlVariables;
// set the method to post (default is GET)
urlRequest.method = URLRequestMethod.POST;
// use navigateToURL to send the urlRequest, use '_self' to open in the same window
navigateToURL(urlRequest, '_self');
I have that line urlRequest.method = URLRequestMethod.POST;
but the URL does not open in the method POST
method-only GET
.
What’s wrong with it ?
Is the second site you want to open yours? Like
navigateToURL
treats variables only asGET
, It may be interesting to use Sharedobject to create some cookies as an alternative.– Gammeth