Were using jquery autocomplete in zend and setup our action like this
public function ajaxautocompleteAction()
{
$postData = $this->_request->getParams();
$term = $postData['term'];
$categoryObj = new Categories();
$result = $categoryObj->searchCategory($term);
$this->view->result = $result;
}
The javascript in the view file is this
$(function() {
var url = "http://www.domain.com/account/ajaxautocomplete?format=json";
$( "#autotest" ).autocomplete({
minLength: 2,
source: function(request, response){
var iterm = request.term;
var url = "http://www.domain.com/account/ajaxautocomplete?format=json";
$.post( url, {term: iterm},
function( data ) {
response(data); });
}
});
});
In chrome console i get this error
XMLHttpRequest cannot load http://www.domain.com/account/ajaxautocomplete?format=json. Origin http://domain.com is not allowed by Access-Control-Allow-Origin.
Any ideas why were not getting results from the ajax request?