how to send a url using Javascript ajax? [duplicate]

Possible Duplicate:
How to encode a URL in JavaScript?

I am trying to send a url using the following code to a php code, but as the url include &a=12&b=4 once I get the value of the "a" variable in my php code the last part of address is removed.

url = but the url that I get in my php file is (&a=12&b=4 is removed, I know the reason is that javascript,ajax mix it up with the url address and do not know its just a value but do not know how to solve it)

         function upload(url){

            if (window.XMLHttpRequest)
            {// code for IE7+, Firefox, Chrome, Opera, Safari
                xmlhttp=new XMLHttpRequest();
            {// code for IE6, IE5
                xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
                if (xmlhttp.readyState==4 && xmlhttp.status==200)
                    document.getElementById("output").innerHTML= xmlhttp.responseText;

       $Address = $_GET["a"];
       echo $Address;


output is >>> "" but it should be

You need to encode the parameter"GET","Photos.php?a="+encodeURIComponent(url),true);

You need to encode the URL. You can use encodeURIComponent(str) and encodeURI(str) like:

var eurl = encodeURIComponent("");"GET","Photos.php?a=" + eurl, true);