I've to make a POST call(with parameter) to an asp form which is located on another server.

For development, I did this on the same server, and it works perfectly, but now I'm testing it on another server, and instead of receiving a 200 status, I receive a 0 status.

I think it's because it's a cross-domain AJAX call, it's the only thing which changed. So how can I make this call? Is there any file I can put on the server/client to allow this call(like flash, ...)?

Thank you!

share|improve this question
    
for futher help we might need to know the natre of the ajax call – dvhh Jul 25 '11 at 12:41
up vote 7 down vote accepted

Yes, assuming you can change the server you connect to

You can implement Cross Origin Resource Sharing (CORS)

You need the server to return Access-Control-Allow-Origin: * if you want to allow all domains to access, otherwise return Access-Control-Allow-Origin: http://yourdomain.com

If you cannot change the server you are accessing, you need to use a proxy on the server your script comes from - alternatively investigate if they have published an API to return for example JSONP

More details here

and several links to the right of this questions

share|improve this answer
1  
the support seems quite limited at the moment. – dvhh Jul 25 '11 at 6:20
    
I took a look at your link, but I can't found where I should declare all these "Access-Control-Allow-Origin", ... – J4N Jul 25 '11 at 6:52
    
@dvhh - it is supported by most modern browsers i.e. FF3.5+, Safari5, IE8+ (using XDR) – mplungjan Jul 25 '11 at 7:41
    
@J4N - Please see update – mplungjan Jul 25 '11 at 7:42
    
Okay, so it's seems that what I want isn't possible – J4N Jul 25 '11 at 9:49

You can either create a proxy script, or use jsonp. The easier course would be to use a proxy script on your server.

share|improve this answer
    
Unfortunately, I'm not able to modify anything on the server – J4N Jul 25 '11 at 6:53
    
another solution would be to rewrite your ajax call to use an iframe instead (unfortunately this is a little bit doggy) – dvhh Jul 25 '11 at 11:46
    
@dvhh but he would only be able to send data, not receive any reply – mplungjan Jul 25 '11 at 11:55
4  
You cannot do JSONP with a POST request. – Jonathon Hill May 15 '12 at 2:09

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.