Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. JavaScript
  4. AJAX,how to get more values from $.ajax({}) function in a Zend Controller

AJAX,how to get more values from $.ajax({}) function in a Zend Controller

Scheduled Pinned Locked Moved JavaScript
helpphpjavascripthtmlsales
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    serenimus
    wrote on last edited by
    #1

    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"); } }

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups