Friday, August 9, 2013

Php Zend Ajax

//** View Page **//

Need jquery.js

function ApprovalSearch() {
 // get the form values
 var search = $('#search').val();

 $.ajax({
   type: "POST",
   url: "/rfc/ajax/searchview/",
   data: "search=" + search,
   success: function(resp){
     // we have the response
  alert("Server said:\n '" + resp + "'");
         document.getElementById("SearchView").innerHTML = resp;
         document.getElementById("Search_head").style.visibility = 'visible';
   },
   error: function(e){
     alert('Error: ' + e);
   }
 });
}

//** controllers **//
  public function searchviewAction(){
   
                        $request = $this->getRequest();
            $registry = Zend_Registry::getInstance(); 
            $DB = $registry['DB'];
            if(isset($_POST['search'])) {
                           $search =  $_POST['search'];
            $rs = $DB->fetchAll("SELECT * FROM access_control ");
                        
          }

No comments:

Post a Comment