Invia il post con AS 3.0
-
27-10-2019 - |
Domanda
Voglio inviare un modulo in Flash e inviare l'utente a un'altra pagina in HTML/PHP e ottenere le informazioni post su quella pagina. Come posso fare questo?
Soluzione
// 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');
Altri suggerimenti
Utilizzare il Urlrequest classe
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow