cross domain ajax

Cross Domain Ajax Request Response

Sometimes we need to send request on a cross domain and need to get response from cross domain.It’s need mostly for using API which send requset from domain to another domain and get response.Suppose your site is example.com and you need to send request on example2.com and need to get response from this url in ajax with jquery event.For that you need to know first how to send request using ajax.In this blog we will know how to send cross domain ajax request and response.

Cross domain Ajax request and response

To know about jquery follow this URL

To know about ajax follow this URL

In the code there is comment for why use that.Can sent get or post method and datatype json.

If you show access control allow origin error on console,it means that that url have no permission to get response from cross domain.For that use this line in expected response url