Select2 Using Xml Web Service

I need some help in making a slight adjustment to one of my files. Any help would be most appreciated.

The registration page on my site has a ‘Company’ field which invokes the Select2 function: www.leadassist.co.uk/register

The Select2 function behind the ‘Company’ field is pulling company names from my SQL database and if you try it you will see that it is operational. However, I now need to point the Select2 function at an XML web service instead of the SQL database, but I cannot get this to work. To give some context: the XML web service will allow me to pull every single company name in the UK, whereas at the moment I can only pull company names that exist within my database.

Here is the full code for the form area that holds the ‘Company’ field:


$form = $this->beginWidget('bootstrap.widgets.BootActiveForm', array(

    'id'=>'user-form',

    'enableAjaxValidation'=>true,

    'type' => 'horizontal',

    'htmlOptions'=>array('class'=>'form-stacked'),

)); ?>


<?php echo $form->dropDownListRow($model,'country_id',CHtml::listData($countries,'id','country'), array('class'=>'span6')); ?>


<div class="control-group">

    <label for="User_company_id" class="control-label required">Company <span class="required">*</span></label>

    <div class="controls">

        <?php echo CHtml::activeHiddenField($model,'company_id'); ?>

        <?php $this->widget('ext.select2.ESelect2',array(

        'selector'=>'#User_company_id',

        'options'=>array(

            'placeholder'=>'Start typing your company name',

            'minimumInputLength'=>3,

            'ajax'=>array(

                'url'=>$this->createUrl('/company/select'),

                'dataType'=>'json',

                'data'=>'js:function(term,page) { return {q: term, page_limit: 3, page: page}; }',

                'results'=>'js:function(data,page) { return {results: data}; }',

            ),

        ),

        'htmlOptions'=>array('class'=>'span8'),

        )); ?>

        <span style="display: none" id="User_company_id_em_" class="help-inline"></span>

    </div>

</div>

Any help would be most appreciated. If I need to provide any further information, please let me know.

Dean.