0

Possible Duplicate:
Ways to circumvent the same-origin policy

Is it possible to enable cross-domain requests with jQuery, without using JSONP?

Community
  • 1
  • 1

2 Answers2

2

You can, by settings this inside jquery.

jQuery.support.cors = true;

This enables you to do cross domain calls with jQuery. It's probably not the best solution, since you are adding a vulnerability by using the following request header: Access-Control-Allow-Origin. I would recommend to see if JSONP is still an option, this option is preferred.

See this post for more information: Making a post request from a sinatra app to a rails app

Community
  • 1
  • 1
Rob Angelier
  • 2,335
  • 16
  • 29
0

yes you should use the header Header set Access-Control-Allow-Origin *

then you can use jsonp. the server should respond to with padding that you have giving in your callback .

you can also use the header header("Access-Control-Allow-Origin: *");(php sccript) on server side

Arun Killu
  • 13,581
  • 5
  • 34
  • 61