How to Enable Cross Origin Resource Sharing (CORS) for Sharing Resource Using Apache Servers, PHP and Jquery

Open the HTML file present on the client side in which you are sending resource request., Mention the IP address of the server side domain and complete path of the file that need to be accessed., Launch the request using your Apache server by...

3 Steps 1 min read Easy

Step-by-Step Guide

  1. Step 1: Open the HTML file present on the client side in which you are sending resource request.

    As shown, the client is sending request to server side for getting customer’s record with ID as ‘145’.
  2. Step 2: Mention the IP address of the server side domain and complete path of the file that need to be accessed.

    As shown, the file demo.php which needs to be accessed is present on the Apache sever (occupying port 80) of the server side domain.

    The server side domain has an IP address of
    192.148.0.108. , As the path indicates, the requesting client side file sub2.html is present inside a folder named as CORS-UsingJquery.

    If the access headers are properly set on the server side, then the record of the customer with ID as ‘145’ will be successfully displayed.
  3. Step 3: Launch the request using your Apache server by putting the URL localhost/CORS-UsingJquery/sub2.html on the web browser’s address bar.

Detailed Guide

As shown, the client is sending request to server side for getting customer’s record with ID as ‘145’.

As shown, the file demo.php which needs to be accessed is present on the Apache sever (occupying port 80) of the server side domain.

The server side domain has an IP address of
192.148.0.108. , As the path indicates, the requesting client side file sub2.html is present inside a folder named as CORS-UsingJquery.

If the access headers are properly set on the server side, then the record of the customer with ID as ‘145’ will be successfully displayed.

About the Author

R

Ruth Perez

Brings years of experience writing about practical skills and related subjects.

30 articles
View all articles

Rate This Guide

--
Loading...
5
0
4
0
3
0
2
0
1
0

How helpful was this guide? Click to rate: