Pass data to ASP and then to database without leaving the page
I have the script like the one below to POST and go to a ASP page and ASP takes care of database integration.
It works when initiated with a button. It will go to the ASP page and submit data to SQL database. How can I modify it, so it will just send the data to ASP without leaving the current page with SWF?
Thanks for the help,
function sendResultToSQL(ev:MouseEvent):void
{
// create a URLRequest object with the target URL:
var url:String = 'http://whatever the page.asp';
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['score'] = score;
urlVariables['q1'] = q1;
urlVariables['q2'] = q2;
urlVariables['q3'] = q3;
... all the data to pass to ASP page and database
// 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');
}
