AJAX,how to get more values from $.ajax({}) function in a Zend Controller
-
Hallo to the comunity, That ist the problem, Im trying to send two values/variables fron my view (opciones.phtml), to my controller/action through an Ajax function. I get it with only one parameter, but with two I dont get it!!:mad: I`ll thank any help this is my html:
guardar
<span class="badge btn-success" id="resultado"></span>this is my javascript function, inside I invoke the ajax function.. <script type="text/javascript"> function saveNombre(){ var nombre=document.getElementById("nombre").value; var codc=<?=$this->codcli?>; if(nombre!==""){ $.ajax({ type:"POST", data:dataString, dataType:{nombre:nombre,codc:codc}, cache:false, url:"<?=$this->basePath("alta/areapersonal/updatenombreclienteajax")?>", success:function(datos){ $("#resultado").html(datos); } }); }else{ return null; } } here you find the data recepcion from view/ajax,in the controller/Action if you send only one parameter, from ajax function, you can easily "clean" the value with the PHP function trim(); but in this case, I,m try to send two values, customer code and Name, I need to include this to parameters in a function to update the name of the customer, but I dont´t konw hoe to extract from $datosCliente, some Idea?, thanks !! public function updateNombreClienteAjaxAction(){ if($this->request->isxmlHttpRequest()){ $datosCliente= $this->request->getContent("data"); }else{ var_dump("Error action Ajax"); } }