title: Ajax request in PhantomJs script
body: <p><strong>Problem:</strong> Ajax request within phantomJs script to a local page doesn't work (no response)</p>
  
  <p><strong>Question:</strong> How can I make it work? Any ideas or possible solutions?</p>
  
  <p><strong>Description:</strong> I'm running a phantomJs script and I need to access some data that is provided by a php function in another page (local). In order to do that, I use an ajax request to that page inside the phantomjs script. However, the request doesn't do anything. The script is:</p>
  
  <pre><code>page.open(url, function (status) {
      page.includeJs('http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js', function () {
          console.log("Solve Captcha");
          $.ajax({
              url: 'captcha.php',
              data: { filename: 'C:\\wamp\\www\\images\\0.png' },
              type: 'post',
              success: function (output) {
                  console.log('Solved');
                  phantom.exit();
              },
          });
      });
  });
  </code></pre>
  
  <p>The php page is in a local WAMP server and it has been tested with ajax (outside a phantomJs script), and it works fine. The script and the php files are in the folder <code>C:\wamp\www</code>, while the image <code>0.png</code> is in the sub-folder <code>C:\wamp\www\images</code>. </p>
  
  <p><strong>Important:</strong> The page <code>captcha.php</code> is in the localhost, while phantomJs is requesting a page that is <strong>not</strong> local, that is, <code>page.open</code> opens a <code>url</code> that is not local.</p>
  
  <p>I don't understand why making this request in a phantomJs script won't work. Could you please help me?</p>