Welcome Guest, Not a member yet? Register   Sign In
Cross domain response to ajax request, cant get over this hump!
#1

[eluser]DevTyme[/eluser]
Hey guys, I need to be able to support ajax requests (post or get, whichever is easier or allowed) to give back some information from my server.

Right now I have been using jQuery ajax / getJSON / get / post, and have had no luck.

It *DOES* work when the ajax is executed from my site, obviously, if you know a little bit about this issue..

Anyhow, how can i get this to work? Do i need to edit some .htaccess files? config? mark up my php response better?

Running linux server by the way.
Thanks!
#2

[eluser]bubbafoley[/eluser]
you need to use jsonp

Code:
$.ajax({
    url: "http://otter.topsy.com/urlinfo.js?url=http://www.nytimes.com",
    dataType: 'jsonp',
    success: function(results){
        console.log(results);
    }
});

http://www.gethifi.com/blog/how-to-use-j...ith-jquery
#3

[eluser]DevTyme[/eluser]
[quote author="bubbafoley" date="1299123684"]you need to use jsonp

Code:
$.ajax({
    url: "http://otter.topsy.com/urlinfo.js?url=http://www.nytimes.com",
    dataType: 'jsonp',
    success: function(results){
        console.log(results);
    }
});

http://www.gethifi.com/blog/how-to-use-j...ith-jquery[/quote]

Perfect, a response finally comes in. I am a bit unsure of how to return the restponse as jsonp rather than a simple string at the moment.




Theme © iAndrew 2016 - Forum software by © MyBB