How to call PHP proxy script from JQuery

Posted by recipriversexclusion on Stack Overflow See other posts from Stack Overflow or by recipriversexclusion
Published on 2010-04-21T02:56:47Z Indexed on 2010/04/21 3:03 UTC
Read the original article Hit count: 273

Filed under:
|
|

I'm trying to get cross-domain Ajax to work. I downloaded a PHP proxy script from the Yahoo Developer site, ran it from command line and verified that it receives the XML from the server with a GET request.

Now, I'm trying to connect to the PHP script within JS with no results. I have the following:

<script type="text/javascript" src="jquery-1.4.2.js"></script>
<script type="text/javascript">
$.ajax({
    type:"GET", 
    url:"proxy.php", 
    dataType:"html", 
    success:function(msg){
        alert(msg);
    }
});
</script>

What this does, though, is to output the source of the PHP script in the alert box, not the XML! Where am I going wrong?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about JavaScript