Guidance On Invoking Web Services From Yii Application Hosted On Two Separate Servers

I am in the process of developing an Yii based application that would connect to an external Restful web service (JSON). The Yii based front end and the web services are hosted on two different servers. The front-end uses a number of AJAX calls to the Restful webservice to update the view.

For example, the Yii application is hosted on domain The form initially displays a number of US states and when the user selects one of the states, it will send a AJAX web service call to display all the available zipcodes for that state:

<script type="text/javascript">



        alert (&quot;Inside the ready function&quot;);

        &#036;(&quot;#zipcode&quot;).load(&quot;;, function(responseTxt,statusTxt,xhr){


              alert(&quot;External content loaded successfully&#33;&quot;);


              alert(&quot;Error: &quot;+ xhr.status+&quot;: &quot;+xhr.statusText);


The above code would not be allowed as the domain of the Yii application is different than that of the web service call ( So in this scenario what would be the strategy for making such calls? Do I need to have the ajax request intercepted by the controller and then the controller would connect to the external service and pass the data back to the view?

Are there any libraries for making such requests and parsing the JSON response to be sent to the view?

Since I am new to the Yii framework, any step-by-step guide/pointers would be much appreciated !