jquery - How to render an element from a controller in cakephp? -


i having trouble figuring out. have element named quoteform in default layout. element has form has few textboxes, checkboxes, submit button etc. submit form , send mail data. on sending mail, replace current div div says message sent successfully.

i have used cakephp ajax on submit, doesnt send mail or refresh div message.

following code

quotes/quoteform.ctp

<?php $this->requestaction('quotes/index'); ?> <script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.min.js"></script> <div id="quotenext">     <?php echo $this->form->create('quote'); ?>     <div class="inputboxa"><?php echo $this->form->input(             'name', array(             'id' => 'name',             'style' => 'width:440px;height:20px;font-size:8pt; background-color:black;color:white;resize:none;border:none;padding-left:5px;padding-top:5px;',             'placeholder' => 'name*', 'type' => 'textarea'         )); ?></div>     <br>      <div class="inputboxb"><?php echo $this->form->input(             'email', array(             'id' => 'email', 'placeholder' => 'e-mail*',             'style' => 'width:440px;font-size:8pt;height:20px;resize:none;background-color:black;color:white;border:none;padding-left:5px;padding-top:5px;',             'type' => 'textarea'         )); ?></div>     <br>      <div class="inputboxc"><?php echo $this->form->input(             'phone', array(             'id' => 'phone', 'placeholder' => 'phone*',             'style' => 'width:440px;font-size:8pt;height:20px;resize:none;background-color:black;color:white;border:none;padding-left:5px;padding-top:5px;',             'type' => 'textarea'         )); ?></div>     <br>      <?php      echo $this->js->submit(         'submit', array(         'success' => $this->js->get('#quotenext')->effect('hide'),         'update' => $this->js->get('#quotesent')->effect('show')     )); ?>     <!--</a>-->     div id="quotesent" class="slide" style="display:none"">       <div id="quotebottom">         <div id="message">             <?php echo $this->session->flash(); ?>             <div id="closediv">close</div>             <?php echo $this->form->end(); ?>         </div>     </div> </div> 

quotescontroller.php

class quotescontroller extends appcontroller {     public $helpers = array('js' => array('jquery1.9.1.min'));     public $components = array('requesthandler');      public function index() {          $email = new cakeemail();          if ($this->request->is('post')) {             $this->quote->set($this->request->data);             if ($this->quote->save($this->request->data)) {                 if ($this->requesthandler->isajax()) {                      $name = $this->request->data['quote']['name'];                     $mail = $this->request->data['quote']['email'];                     $email->from(array($mail => $name));                     $email->to('anniecherian79@gmail.com');                     if (isset($this->request->data['quote']['solutioncheckbox'])) {                         $ctime = implode(',', $this->request->data['quote']['solutioncheckbox']);                     }                     $message = "phone no : " . $this->request->data['quote']['phone'] . "\n\nbest contact time :" . $ctime . " \n\nmessage : " . $this->request->data['quote']['message'];                     $email->subject('blacknova website instant quote form');                     $email->send($message);                      if ($email->send($message)) {                         $this->session->setflash('quote processed..thank visiting our website!!!');                         $this->render('/view/elements/quotes/quoteform.ctp');                      }                 }               }         }     } } 

in short, on ending mail, display message in #quotesent, possible?


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -