title: Sending URL as a parameter using javascript
body: <p>I have to send a name and a link from client side to the server. I thought of using AJAX called by Javascript to do this.</p>
  
  <p>This is what I mean. I wished to make an ajax request to a file called abc.php with parameters :-</p>
  
  <pre><code>1. http://thumbs2.ebaystatic.com/m/m7dFgOtLUUUSpktHRspjhXw/140.jpg
  
  2. Apple iPod touch, 3rd generation, 32GB
  </code></pre>
  
  <p>To begin with, I encoded the URL and tried to send it. But the server says status Forbidden</p>
  
  <p>Any solution to this ?</p>
  
  <p>UPDATE ::</p>
  
  <p>It end up calling to </p>
  
  <pre><code>http://abc.com/addToWishlist.php?rand=506075547542422&amp;image=http://thumbs1.ebaystatic.com/m/mO64jQrMqam2jde9aKiXC9A/140.jpg&amp;prod=Flat%20USB%20Data%20Sync%20Charging%20Charger%20Cable%20Apple%20iPhone%204G%204S%20iPod%20Touch%20Nano
  </code></pre>
  
  <p>Javascript Code ::</p>
  
  <pre><code>function addToWishlist(num) {
  var myurl = "addToWishlist.php";
  var myurl1 = myurl;
  myRand = parseInt(Math.random()*999999999999999);
  
  var rand  = "?rand="+myRand ;
  var modurl = myurl1+ rand + "&amp;image=" + encodeURI(storeArray[num][1]) + "&amp;prod=" + encodeURI(storeArray[num][0]);
  httpq2.open("GET", modurl, true);
  httpq2.onreadystatechange = useHttpResponseq2;
  httpq2.send(null);
  }
  function useHttpResponseq2() {
  if (httpq2.readyState == 4) {
  if(httpq2.status == 200) {
  var mytext = httpq2.responseText;
  document.getElementById('wish' + num).innerHTML = "Added to your wishlist.";
  }
  }
  }
  </code></pre>
  
  <p>Server Code </p>
  
  <pre><code>&lt;?php
  include('/home/ankit/public_html/connect_db.php');
  
  $image = $_GET['image'];
  $prod = $_GET['prod'];
  $id = $_GET['id'];
  
  
  
  echo $prod;
  echo $image;
  ?&gt;
  </code></pre>
  
  <p>As I mentioned, its pretty basics</p>
  
  <p>More Updates :</p>
  
  <p>On trying to send a POST request via AJAX to the server, it says :-</p>
  
  <pre><code>Refused to set unsafe header "Content-length"
  Refused to set unsafe header "Connection"
  </code></pre>