如何在同一页面中将值从javascript传递到php

Im tying to implament a preloader for swf based on this Post, but im getting trouble passing the javascript value to a php variable.

     <script type="text/javascript">

        var swfJSPreLoaderConfig = {

         'assets':['swf/test.swf'],

            'assetLoaded': function( asset){

             alert(asset);

            },}

    </script>

The alert in the above code shows only when the swf file test.swf is fully downloaded. the value that im trying to get in php is asset ( this value contain the swf file path, in this example is swf/test.swf. the alert fires always when the swf files is fully dowloaded and it works very good.)

i tried something like this to get it in a php variable. but no lucky.

$filename = $_REQUEST['asset'];

also i tired using ajax but nothing.

    <script type="text/javascript">

     var swfJSPreLoaderConfig = {

       'assets':['swf/test.swf'],

         'assetLoaded': function( asset){   

                $.ajax ({ 
                type: "post",
                url: "index.php",
                data: { 'asset': asset },
                success: function()
                    {
                        alert(asset);
                    }
                });

            },}

    </script>

and then

 $filename = $_REQUEST['asset'];

Whats worng?

Try this,

data: { 'asset': asset },
success: function(response)
     {
        alert(response);
     }

instead of,

  data: { 'asset': asset },
  success: function()
        {
          alert(asset);
        }
  });

PHP:

 echo $filename = $_REQUEST['asset'];

Change from

url: "index.php"

to

url: "index.php?asset="+asset

Then in PHP, use:

echo $_GET['asset'];

to confirm that you are sending the correct value